#K79432. Lexicographically Smallest Rotation

    ID: 35307 Type: Default 1000ms 256MiB

Lexicographically Smallest Rotation

Lexicographically Smallest Rotation

You are given a string s. Your task is to compute its lexicographically smallest rotation. A rotation of a string is defined as taking a prefix of the string and moving it to the end. Formally, for a string \( s \) of length \( n \), the rotation by \( i \) positions is given by:

\[ \text{rotation}(i) = s[i:] + s[:i], \quad 0 \le i < n. \]

Your task is to find the smallest string among all rotations, i.e., compute \[ \min_{0 \le i < n} \bigl(s[i:] + s[:i]\bigr). \]

For example, if s = "bca", its rotations are "bca", "cab", and "abc". The lexicographically smallest is "abc".

inputFormat

The input consists of a single line that contains the string s. The string contains only lowercase English letters and has a length at least 1.

outputFormat

Output the lexicographically smallest rotated version of the input string.

## sample
bca
abc