cswork / OA打开练习工作台

MicrosoftOA #26

Get Alphabetically Smallest String

估计简单可在线判题

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

Delete exactly one character from a lowercase string and return the lexicographically smallest remaining string.

输入格式

One line of 2..100000 lowercase letters.

输出格式

Output the smallest string obtainable by deleting one character.

样例 1

输入:

acb

输出:

ab

样例 2

输入:

hot

输出:

ho

样例 3

输入:

aaaa

输出:

aaa

样例说明

Example 1: deleting c gives ab, which is smaller than ac and cb.

Example 2: the string is non-decreasing, so deleting the last t gives ho.

Example 3: deleting any a gives aaa.