#K46707. Largest Number After Deleting One Digit

    ID: 28036 Type: Default 1000ms 256MiB

Largest Number After Deleting One Digit

Largest Number After Deleting One Digit

You are given a string S consisting of digits only. Your task is to remove exactly one digit from the string such that the resulting number (when read from left to right) is as large as possible.

Formally, let \(S = d_1d_2d_3\ldots d_n\) be a string of digits. By deleting the digit at position \(i\) (where \(1 \le i \le n\)), you obtain a new string \(S' = d_1\ldots d_{i-1}d_{i+1}\ldots d_n\). You need to choose the deletion that yields the maximum possible string when compared lexicographically (which is equivalent to the maximum numerical value since all resulting strings have equal length).

Example:

  • For S = "12345", deleting the first digit gives "2345" which is the maximum possible.
  • For S = "54321", deleting the last digit gives "5432" which is the maximum possible.
  • For S = "11111", no matter which digit is deleted, the result is "1111".

inputFormat

The input consists of a single non-empty line containing a string of digits. The string does not have spaces and may include leading zeros.

outputFormat

Output a single line containing the largest number (as a string) that can be obtained by deleting exactly one digit from the input string.

## sample
12345
2345