#K66032. Smallest Lexicographical Permutation Removal
Smallest Lexicographical Permutation Removal
Smallest Lexicographical Permutation Removal
Given a string \(S\) consisting of lowercase English letters, remove exactly one character from \(S\) such that the remaining string is the smallest possible in lexicographical order. In other words, you are allowed to remove one character at any position in the string, and you must choose the removal that yields the lexicographically smallest result. It is guaranteed that \(S\) has at least two characters.
For example, if \(S = \texttt{abc}\), by removing the first character, the result is \(\texttt{bc}\) but removing the last character produces \(\texttt{ab}\) which is smaller lexicographically, hence the answer is \(\texttt{ab}\).
inputFormat
Input consists of a single line containing a string \(S\) (\(2 \leq |S| \leq 10^5\)), composed of lowercase English letters.
outputFormat
Output the lexicographically smallest string that can be obtained by removing exactly one character from \(S\).
## sampleabc
ab