当前位置: 首页 > 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语言运算符优先级列表
  • 康托展开和逆康托展开
  • [ JavaScript ] 数据结构与算法 —— 链表
  • Git初体验
  • input实现文字超出省略号功能
  • Javascript基础之Array数组API
  • mysql外键的使用
  • React 快速上手 - 06 容器组件、展示组件、操作组件
  • SpiderData 2019年2月23日 DApp数据排行榜
  • Spring Boot MyBatis配置多种数据库
  • Vue--数据传输
  • 开年巨制!千人千面回放技术让你“看到”Flutter用户侧问题
  • 理清楚Vue的结构
  • 那些年我们用过的显示性能指标
  • 思考 CSS 架构
  • 微信小程序开发问题汇总
  • gunicorn工作原理
  • ​​​​​​​GitLab 之 GitLab-Runner 安装,配置与问题汇总
  • #Linux(权限管理)
  • #Linux杂记--将Python3的源码编译为.so文件方法与Linux环境下的交叉编译方法
  • #pragam once 和 #ifndef 预编译头
  • #中的引用型是什么意识_Java中四种引用有什么区别以及应用场景
  • (20)目标检测算法之YOLOv5计算预选框、详解anchor计算
  • (a /b)*c的值
  • (Redis使用系列) Springboot 整合Redisson 实现分布式锁 七
  • (六)软件测试分工
  • (十八)devops持续集成开发——使用docker安装部署jenkins流水线服务
  • (转)chrome浏览器收藏夹(书签)的导出与导入
  • (转)Mysql的优化设置
  • (转)关于多人操作数据的处理策略
  • (转载)从 Java 代码到 Java 堆
  • **PHP分步表单提交思路(分页表单提交)
  • *_zh_CN.properties 国际化资源文件 struts 防乱码等
  • ... fatal error LINK1120:1个无法解析的外部命令 的解决办法
  • .naturalWidth 和naturalHeight属性,
  • .NET Framework 的 bug?try-catch-when 中如果 when 语句抛出异常,程序将彻底崩溃
  • .NET企业级应用架构设计系列之开场白
  • .Net下的签名与混淆
  • @for /l %i in (1,1,10) do md %i 批处理自动建立目录
  • @RequestParam详解
  • [2669]2-2 Time类的定义
  • [AutoSar]BSW_OS 02 Autosar OS_STACK