P14030 [Kattis] Repeatedsubstrings
提高
题目描述

Given an input string composed solely of lowercase English letters, find the longest substring that occurs more than once in the input string. The two occurrences are allowed to partially overlap.

-----Input-----
The input is a single line containing a string of lowercase letters. The string contains more than one character, but no more than $10^5$. At least one letter will appear at least twice.

-----Output-----
Print a single line of output: the longest substring that occurs more than once in the input string. If there are multiple longest repeated substrings, print the one the would come first when the longest substrings are sorted in lexicographical (alphabetical) order.

-----Examples-----
Sample Input 1:
abcefgabc
Sample Output 1:
abc

Sample Input 2:
abcbabcba
Sample Output 2:
abcba

Sample Input 3:
aaaa
Sample Output 3:
aaa

输入格式

见题面

输出格式

见题面

样例输入
abcefgabc
样例输出
abc