시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 138 | 58 | 55 | 44.000% |
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.
The input is a single line containing a string of lowercase letters. The string contains more than one character, but no more than 105. At least one letter will appear at least twice.
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.
abcefgabc
abc
abcbabcba
abcba
aaaa
aaa
bbcaadbbeaa
aa