#C5787. Lexicographically Smallest String After Removal
Lexicographically Smallest String After Removal
Lexicographically Smallest String After Removal
You are given a string (S) consisting of lowercase English letters. Your task is to remove exactly one character from (S) so that the resulting string is the lexicographically smallest possible. If (S) contains only one character, removing that character yields an empty string.
A string (A) is said to be lexicographically smaller than a string (B) if either (A) is a prefix of (B) (and (A \neq B)) or there exists an index (i) such that (A_j = B_j) for all (j < i) and (A_i < B_i).
For each test case, perform the deletion operation optimally and output the resulting string.
inputFormat
The first line contains an integer (T), the number of test cases. Each of the following (T) lines contains a non-empty string (S) of lowercase English letters.
outputFormat
For each test case, output the lexicographically smallest string obtainable after removing exactly one character from (S) on a new line.## sample
5
cba
acb
abc
a
zbcdef
ba
ab
ab
bcdef
</p>