#P6456. [COCI 2006/2007 #5] DVAPUT
[COCI 2006/2007 #5] DVAPUT
Problem Description
Given a string of length , you need to find the longest substring that appears at least twice in the string (at different positions). Output its length.
Input Format
The first line contains an integer , representing the length of the string.
The second line contains a string of length .
Output Format
Output one line containing one integer, representing the length of this longest substring.
11
sabcabcfabc
3
18
trutrutiktiktappop
4
6
abcdef
0
Hint
Constraints
For of the testdata, it is guaranteed that , and the input string consists only of lowercase letters.
Notes
This problem is translated from COCI2006-2007 CONTEST #5 T6 DVAPUT.
Translated by ChatGPT 5