#K37482. Smallest Lexicographical String by Prefix Rotations

    ID: 25986 Type: Default 1000ms 256MiB

Smallest Lexicographical String by Prefix Rotations

Smallest Lexicographical String by Prefix Rotations

Given a string (s), you are allowed to perform a cyclic rotation operation. A rotation operation is defined as taking a prefix of the string and moving it to the end. Your task is to find the lexicographically smallest string that can be obtained by performing a sequence of such rotations.

Mathematically, for a string (s) of length (n), you need to compute
(\min_{0 \leq i < n} { s[i:] + s[:i] }).

This problem tests your ability to perform string manipulation and compare lexicographical order.

inputFormat

The input consists of a single line containing a non-empty string (s) composed of lowercase English letters.

outputFormat

Output a single line containing the lexicographically smallest string obtainable by performing a cyclic rotation on the input string.## sample

a
a