The children's railway#332

The children's railway

0.1 seconds
64 megabytes
Medium

Vitek does not stop playing with cubes. His father has given him a toy railway. Vitek places some cubes, one per wagon, and before finishing the game, wants to rearrange the train so that the obtained word is the lexicographically smallest possible among all options. However, since he has already played enough, he can only once detach any number of cubes from the front and, with the locomotive, move them to the end of the train.

What word will Vitek obtain?

Input

The first and only line contains the given word. The cubes have only uppercase Latin letters, and their number does not exceed .

Output

The word formed by Vitek.

Examples

Example 1

Loading
Loading