#K44617. Smallest Lexicographical String after Removal

    ID: 27572 Type: Default 1000ms 256MiB

Smallest Lexicographical String after Removal

Smallest Lexicographical String after Removal

Given a list of strings, for each string, remove exactly one character such that the resulting string is the lexicographically smallest possible. In other words, for a string S, consider all possible strings formed by removing one character (i.e. S[0:i] + S[i+1:]), and choose the minimum string in lexicographical order. This challenge will test your ability to manipulate strings and to implement a brute-force solution that considers every possible removal.

inputFormat

The first line of input contains an integer T, the number of test cases. Each of the following T lines contains a single string S. It is guaranteed that each string has at least two characters.

outputFormat

For each test case, output the lexicographically smallest string that can be obtained by removing exactly one character from the given string. Each result should be printed on its own line.## sample

1
abc
ab

</p>