#c22404. 最小循环覆盖2
最小循环覆盖2
Minimum Cyclic Cover 2 (Lexicographically Smallest)
Problem Description
You are given a string , and you need to find the lexicographically smallest minimum cyclic cover of this string.
is the minimum cyclic cover of if and only if is a substring of the string obtained by concatenating multiple copies of , and is the shortest string satisfying this condition. You need to find the lexicographically smallest minimum cyclic cover.
Given a string , output a string: the lexicographically smallest minimum cyclic cover.
Input Format
One line containing a string .
Output Format
Output one line containing a string: the answer.
Sample Input 1
bcabcabcabcab
Sample Output 1
abc
Sample Input 2
aaaaaaa
Sample Output 2
a
Constraints
For all data, , and the string consists of lowercase letters only.