#d2959. 子串最大循环次数
子串最大循环次数
Maximum Repetition Count of a Substring
Problem Description
For a given string, if a substring can be formed by repeating some shorter string (the period) times (), we say the repetition count of that substring is . Define the repetition count of the whole string as the maximum repetition count over all of its substrings.
For example, in the string psdababab2345 the substring ababab is formed by repeating ab times, so its repetition count is .
You are given strings; for each, find its repetition count.
Input Format
The first line contains an integer (), the number of strings.
The next lines each contain one string consisting only of uppercase / lowercase letters and digits. The length of each string is less than , and is guaranteed.
Output Format
For each test case, output one integer on a single line, the repetition count of that string.
Sample Input
2
psdababab2345
avabcdad
Sample Output
3
1
Sample Explanation
psdababab2345: the substring ababab repeats ab times, so the answer is .
avabcdad: there is no substring whose repetition count is greater than , so the answer is .