#c22404. 最小循环覆盖2

最小循环覆盖2

Minimum Cyclic Cover 2 (Lexicographically Smallest)

Problem Description

You are given a string aa, and you need to find the lexicographically smallest minimum cyclic cover of this string.

bb is the minimum cyclic cover of aa if and only if aa is a substring of the string obtained by concatenating multiple copies of bb, and bb is the shortest string satisfying this condition. You need to find the lexicographically smallest minimum cyclic cover.

Given a string aa, output a string: the lexicographically smallest minimum cyclic cover.

Input Format

One line containing a string aa.

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, 1≤∣a∣≤1051 \leq |a| \leq 10^5, and the string consists of lowercase letters only.