题目描述
Problem Description
Given a string of length $L$, you need to find the longest substring that appears at least twice (in different positions) within the string. Output its length.
Input Format
The first line of input contains an integer $L$, representing the length of the string.
The second line contains a string of length $L$.
Output Format
Output a single integer, representing the length of the longest substring that appears at least twice.
Sample Input and Output
Sample Input #1
11
sabcabcfabc
Sample Output #1
3
Sample Input #2
18
trutrutiktiktappop
Sample Output #2
4
Sample Input #3
6
abcdef
Sample Output #3
0
Notes
Data Size and Constraints
For $100\%$ of the data, it is guaranteed that $1 \le L \le 2 \times 10^5$, and the input string consists of lowercase letters.
Note
This problem is translated from COCI2006-2007 CONTEST #5 T6 DVAPUT.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
11
sabcabcfabc
样例输出
3