#K52112. Increment String

    ID: 29238 Type: Default 1000ms 256MiB

Increment String

Increment String

Given a string, your task is to increment its trailing number by one. If the string does not have a trailing number, append the digit "1". When incrementing, ensure that any leading zeros in the numeric part are preserved.

For example, if the input is "foobar001", the output should be "foobar002". If the input is "foo", since there is no numerical part, the output should be "foo1".

The problem requires reading input from standard input and outputting the result to standard output.

Mathematically, if a string S can be represented as S = prefix + N, where N is the trailing number (possibly with leading zeros), then the answer is: \[ \text{answer} = \text{prefix} + \text{formatted}(N + 1) \] where \( \text{formatted}(\cdot) \) preserves the original length of N by padding with zeros if necessary.

inputFormat

The input consists of a single line that contains a string. The string may include letters, digits, or special characters.

outputFormat

Output a single line containing the modified string after incrementing the trailing number (or appending "1" if no trailing number is present).

## sample
foobar001
foobar002