78 - ZOJ Monthly, May 2009 - G
Write a program that takes a string and returns length of the longest repeated substring. A repeated substring is a sequence of characters that is immediately followed by itself.
For example, given "Mississippi", the longest repeated substring is "iss" or "ssi" (not "issi").
The first line of the input contains a single integer T , the number of test cases.
Each of the following T lines, is exactly one string of lowercase charactors.
The length of each string is at most 50000 characters.
For each test case, print the length of the Longest Repeated Substring.
2 aaabcabc ab
Author: PENG, Peng
Source: ZOJ Monthly, May 2009