cswork / OA打开练习工作台

AmazonOA #183

Find Obfuscate Message

估计中等可在线判题

考点(AI 标注)字符串贪心调度

Choose exactly one non-empty substring and rotate it right by 1, i.e. move its last character to the front and shift the other characters right. Find the lexicographically smallest resulting string. Choosing a single character, which leaves the string unchanged, is allowed.

输入格式

One line containing a lowercase string of length 1..100000.

输出格式

Output the smallest string.

样例 1

输入:

aahhab

输出:

aaahhb

样例 2

输入:

abc

输出:

abc

样例 3

输入:

cbaba

输出:

acbab

样例说明

The answers are aaahhb, abc and acbab.