#K88417. Smallest Lexicographical String After One Character Removal
Smallest Lexicographical String After One Character Removal
Smallest Lexicographical String After One Character Removal
Given t strings, for each string, remove exactly one character such that the resulting string is the smallest in lexicographical order. That is, for each string s of length n, consider all strings obtained by removing the ith character (where 1 \le i \le n). Formally, if s = s_1 s_2 \ldots s_n, then after removing the ith character, the new string is:
$$\textbf{s'} = s_1 s_2 \ldots s_{i-1} s_{i+1} \ldots s_n. $$Your task is to compute and print the smallest (in lexicographical order) string that can be obtained after exactly one removal for each input string.
Note: Lexicographical order is the typical dictionary order.
inputFormat
The input is given via standard input (stdin). The first line of input contains a single integer t (the number of test cases). This is followed by t lines, each containing a non-empty string consisting of lowercase English letters.
outputFormat
For each test case, output the smallest lexicographical string (obtained after removing exactly one character) on a separate line via standard output (stdout).
## sample3
abc
aaa
az
ab
aa
a
</p>