TWICE - Twice
Given a string S, find the longest substring that appears at least twice in S (occurrences may overlap).
The first line contains an integer L (1 ≤ L ≤ 200000), the length of S.
The second line contains the string S, consisting of exactly L lowercase letters ('a'-'z').
Output the length of the longest substring that appears at least twice in S. If there is no such substring, output 0.
Buda IM (retired):
Suffix array is not needed to solve this problem
Too bad - I don't know O(N) construction of suffix tree yet :(
> is substring of length 1 is also considered??