Time limit
2s
Memory limit
128 MB
You are given a string S of length L consisting only of lowercase English letters. A substring of S is called a repeated substring if it appears at least twice in the whole string.
Given S, find the length of the longest repeated substring.
The first line contains the length L of the string. (1 ≤ L ≤ 200,000)
The second line contains the length-L string S, consisting only of lowercase English letters and written without spaces.
Print the length of the longest repeated substring on the first line. If no repeated substring exists, print 0.