|| ||Code Submission Evaluation System
CSES Problem Set
Task | Statistics
CSES - String TransformCSES - String Transform
|Time limit:||1.00 s
||Memory limit:||512 MB|
Consider the following string transformation:
- append the character # to the string (we assume that # is lexicographically smaller than all characters of the string)
- generate all rotations of the string
- sort the rotations in increasing order
- based on this order, construct a new string that contains the last character of each rotation
For example, the string
. Then, the sorted list of rotations is
. This yields a string
The only input line contains the transformed string of length $n+1$. Each character of the original string is between a–z.
Print the original string of length $n$.