UVA 455 – Periodic Strings
来源:互联网 发布:女王级战列舰 知乎 编辑:程序博客网 时间:2024/06/06 07:08
A character string is said to have period k if it can be formed by concatenating one or more repetitions of another string of length k. For example, the string "abcabcabcabc"has period 3, since it is formed by 4 repetitions of the string "abc". It also has periods 6 (two repetitions of "abcabc") and 12 (one repetition of "abcabcabcabc").
Write a program to read a character string and determine its smallest period.
Input
The first line oif the input file will contain a single integer N indicating how many test case that your program will test followed by a blank line. Each test case will contain a single character string
of up to 80 non-blank characters. Two consecutive input will separated by a blank line.
Output
An integer denoting the smallest period of the input string for each input. Two consecutive output are separated by a blank line.
Sample Input
1HoHoHo
Sample Output
2
如果一个字符串可以由某个长度为k的字符串重复多次得到,则称该串以k为周期。输入一个字符串输出最小周期。
- UVA 455 – Periodic Strings
- UVA 455 - Periodic Strings
- UVa 455 - Periodic Strings
- UVa 455 - Periodic Strings
- UVa 455 - Periodic Strings
- UVa 455 Periodic Strings
- UVa - 455 Periodic Strings
- UVa 455 Periodic Strings
- UVa 455 - Periodic Strings
- Uva 455-periodic strings
- Uva 455-periodic strings
- UVa-455Periodic Strings
- 【Uva 455】 Periodic Strings
- UVA - 455 Periodic Strings
- UVa 455 - Periodic Strings
- Uva - 455 - Periodic Strings
- UVA - 455 Periodic Strings
- UVa 455 - Periodic Strings
- Linux离线编译安装Python环境
- 学习笔记 新浪微博篇 三 Android SQLiteOpenHelper 类详解
- Android 自定义底部导航栏和动态添加fragment
- 基础备忘:智能指针小分析
- 登录页面图片验证码的实现
- UVA 455 – Periodic Strings
- mysql中orderby和limit同时使用的bug
- 辅助功能——final关键字+对象的多态性
- UVA - 227 Puzzle
- 聪明一点的NPC寻路
- JQuery 学习笔记
- 将两个有序链表合并成一个新的有序链表
- Android Fragment 真正的完全解析(下)
- 创建博客-完善关注功能(2)