ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Неотсортированные > задача:


Minimal Rotation

Задачи раздела

• Money Sums
• Apartments
• Ferris Wheel
• Stick Lengths
• Traffic Lights
• Concert Tickets
• Finding Borders
• Finding Periods
• Minimal Rotation
• Minimizing Coins
• Missing Coin Sum
• Distinct Numbers
• Dice Combinations
• Collecting Numbers
• Maximum Subarray Sum
• Static Range Sum Queries
• A+B

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 4000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Сложность Альфа


A rotation of a string can be generated by moving characters one after another from beginning to end. For example, the rotations of acab are acab, caba, abac, and baca.

Your task is to determine the lexicographically minimal rotation of a string.

Input

The only input line contains a string of length n. Each character is one of a–z.

Output

Print the lexicographically minimal rotation.

Constraints
1≤n≤106

Example
Input:
acab

Output:
abac


Для отправки решений необходимо выполнить вход.

www.contester.ru