eolymp
bolt
Try our new interface for solving problems
Problems

Horatio Riddle

Horatio Riddle

\includegraphics{https://static.e-olymp.com/content/c6/c650a7e231d5374d8fe060002dee71af4c5037bd.jpg} In his youth Horatio was fond of creation the full heraldic names. And this is a hard problem - if you make a mistake, then some Duke immediately will send you directly to Yorik. The rules are simple: Duke gives Horatio his ancestral title and Horatio finds its lexicographic minimum cyclic shift. Not everyone in the Danish kingdom can do it! But now Horatio doesn't like such sessions and he needs a successor. Try yourself in this business! \InputFile One string - the Duke's ancestral title, consisting of no more than \textbf{100000} Latin lowercase letters. \OutputFile Print in one line the correct Duke's heraldic name.
Time limit 1 second
Memory limit 64 MiB
Input example #1
thehereditarydukeofdanishlandslaertthesonofpoloniy
Output example #1
aertthesonofpoloniythehereditarydukeofdanishlandsl