#K82237. Lexicographically Smallest String
Lexicographically Smallest String
Lexicographically Smallest String
Given a string s, remove exactly one character from it such that the resulting string is lexicographically smallest.
For a string s of length n, you need to remove one character at position i (with 0 ≤ i < n) to obtain a candidate string, and then choose the smallest of these candidates in lexicographical order.
Formally, if we denote by \( s_0s_1\dots s_{n-1} \) the original string, then for each position \( i \) (from 0 to \( n-1 \)), the candidate string is:
\( s_0s_1\dots s_{i-1}s_{i+1}\dots s_{n-1} \)
You need to output the candidate that is smallest in lexicographical order.
Note: Lexicographical order is the dictionary order: a string a is considered smaller than a string b if in the first position where they differ, the character in a comes before the character in b in the alphabet.
inputFormat
The input consists of a single line containing a non-empty string s composed of lowercase letters.
You should read from standard input.
outputFormat
Output the lexicographically smallest string that can be obtained by removing exactly one character from s.
The answer should be printed to standard output.
## sampleabcda
abca