Repeated Substrings
시간 제한: 2000ms메모리 제한: 512MB출처: ICPC Mid-Central Regional 2018BOJ 16415
문제
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.
예제
예제 1
입력
abcefgabc
출력
abc
예제 2
입력
abcbabcba
출력
abcba
예제 3
입력
aaaa
출력
aaa
예제 4
입력
bbcaadbbeaa
출력
aa
코드를 제출하려면 로그인하세요.