cswork / OA打开练习工作台

VisaOA #6

Lexicographically Smallest by Reversing Prefix/Suffix

估计简单可在线判题

考点(AI 标注)字符串

Given a lowercase string, reverse exactly one non-empty prefix or suffix exactly once, and find the lexicographically smallest of all results.

输入格式

A non-empty lowercase string; this site adds |word|≤2000 so that all candidates can be enumerated directly.

输出格式

Output the smallest result.

样例 1

输入:

edcba

输出:

abcde

样例 2

输入:

a

输出:

a

样例 3

输入:

bac

输出:

abc