当前位置: 首页 > news >正文

[POJ 2406]Power Strings[KMP]

Description
Given two strings a and b we define a*b to be their concatenation. For example, if a = “abc” and b = “def” then a*b = “abcdef”. If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a^0 = “” (the empty string) and a^(n+1) = a*(a^n).

Input
Each test case is a line of input representing s, a string of printable characters. The length of s will be at least 1 and will not exceed 1 million characters. A line containing a period follows the last test case.

Output
For each s you should print the largest n such that s = a^n for some string a.

Sample Input

abcd
aaaa
ababab
.

Sample Output

1
4
3

Hint
This problem has huge input, use scanf instead of cin to avoid time limit exceed.

Source
Waterloo local 2002.07.01

一句话题意: 给一个字符串S,

相关文章:

  • markdown语法
  • BestCoder 2nd Anniversary #1001-oracle
  • [NOIP 2015] Day.1 T1 神奇的幻方 [模拟]
  • [NOIP 2015]Day.1 T2 信息传递 【最小环】
  • 查找有向图中的环
  • 求无向图最小环算法-floyd
  • [hdu 3746] Cyclic Nacklace [kmp]
  • [poj 2001]Shortest Prefixes [Trie]
  • Trie - 字典树 模板
  • [hdu 1247]Hat’s Words [Trie 图]
  • Trie树专题 [转]
  • using声明、using指示及其作用域详解
  • using声明、using指示用于嵌套命名空间时的作用域
  • C语言运算符优先级列表
  • 康托展开和逆康托展开
  • angular学习第一篇-----环境搭建
  • GitUp, 你不可错过的秀外慧中的git工具
  • javascript 总结(常用工具类的封装)
  • JDK 6和JDK 7中的substring()方法
  • Laravel深入学习6 - 应用体系结构:解耦事件处理器
  • Less 日常用法
  • Linux学习笔记6-使用fdisk进行磁盘管理
  • spring cloud gateway 源码解析(4)跨域问题处理
  • 如何解决微信端直接跳WAP端
  • 如何优雅的使用vue+Dcloud(Hbuild)开发混合app
  • 软件开发学习的5大技巧,你知道吗?
  • 深度学习在携程攻略社区的应用
  • 我与Jetbrains的这些年
  • 学习Vue.js的五个小例子
  • 在weex里面使用chart图表
  • 扩展资源服务器解决oauth2 性能瓶颈
  • # Panda3d 碰撞检测系统介绍
  • #if #elif #endif
  • $(selector).each()和$.each()的区别
  • (Demo分享)利用原生JavaScript-随机数-实现做一个烟花案例
  • (libusb) usb口自动刷新
  • (编程语言界的丐帮 C#).NET MD5 HASH 哈希 加密 与JAVA 互通
  • ***检测工具之RKHunter AIDE
  • .describe() python_Python-Win32com-Excel
  • .NET MVC 验证码
  • .Net 访问电子邮箱-LumiSoft.Net,好用
  • .NET 设计一套高性能的弱事件机制
  • .net开发时的诡异问题,button的onclick事件无效
  • .NET中GET与SET的用法
  • .net专家(高海东的专栏)
  • .pings勒索病毒的威胁:如何应对.pings勒索病毒的突袭?
  • [ 环境搭建篇 ] 安装 java 环境并配置环境变量(附 JDK1.8 安装包)
  • [17]JAVAEE-HTTP协议
  • [Avalon] Avalon中的Conditional Formatting.
  • [CF226E]Noble Knight's Path
  • [ComfyUI进阶教程] animatediff视频提示词书写要点
  • [docker] Docker的私有仓库部署——Harbor
  • [hdu 4552] 怪盗基德的挑战书
  • [linux] 创建用户
  • [python]用python获取EXCEL文件内容并保存到DBC