- Time limit: 1.00 s
- Memory limit: 512 MB
You are given a string with length and your task is to find the longest repeating substring. A repeating substring of is a substring of such that it appears at least twice in . The appearances of substrings can overlap.
Input
The first and only line of input contains string with characters between a-z. All letters are small case.
Output
Output the longest repeating substring.
If there are multiple equally long repeating substrings, you should print the lexicographically smallest such string.
Limits
Example
Input:
abcdabcdabcd
Output:
abcdabcd