Longest Repeat
Print the length of the longest substring that occurs at least TWICE in S (overlaps allowed).
Input: one line with the string S.
Output: the longest repeated-substring length (0 if none).
Constraints:
- 1 ≤ |S| ≤ 105
- lowercase letters
Sample Tests
Input 1
banana
Output 1
3
Input 2
abcd
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.