#K60037. Maximum Number After Deleting a Digit
Maximum Number After Deleting a Digit
Maximum Number After Deleting a Digit
Given a non-empty string composed of digits (0-9), remove exactly one digit so that the remaining digits form the maximum possible integer. Formally, given a string \( S \) where \( S \) is of length at least 2, you need to choose an index \( i \) (where \( 0 \le i < |S| \)) and remove the digit at that position. Let \( T \) be the string after removal. Your task is to compute \( \max_{0 \le i < |S|} \{ \text{int}(T) \} \), where \( \text{int}(T) \) denotes the integer value of \( T \) (ignoring any leading zeros).
For example:
- For
S = "123"
, removing the first digit yields23
. - For
S = "51423"
, removing the digit '1' yields5423
. - For
S = "9876"
, the maximum value obtained is987
.
You are required to handle multiple test cases reading from standard input, with each test case on a separate line after the initial count.
inputFormat
The input is read from standard input and has the following format:
- The first line contains a single integer \( T \) (\(1 \le T \le 100\)), the number of test cases.
- Each of the next \( T \) lines contains a non-empty string \( S \) consisting only of digits. The length of \( S \) is at least 2.
outputFormat
For each test case, output a single line containing the maximum integer obtainable by deleting exactly one digit from the string.
## sample1
123
23