#K56782. Reorder Digits in a String
Reorder Digits in a String
Reorder Digits in a String
You are given a string that consists of lowercase letters and digits. Your task is to reorder only the digits in the string so that they appear in ascending order, while the letters remain in their original order.
For example, if the input string is a1b3c2
, then the digits 1, 3, 2
will be reordered to 1, 2, 3
and the output will be a1b2c3
.
The problem can be formally stated using the following notation:
$$\text{Let } s \text{ be the input string. Reorder all characters \( c \) such that if \( c \) is a digit, its order is determined by the ascending order of all digits in \( s \), while if \( c \) is a letter, its position remains unchanged.} $$Your solution should read the input from stdin and print the resulting string to stdout.
inputFormat
The input is provided via stdin and consists of a single line containing a non-empty string \( s \), which includes lowercase letters and digits.
outputFormat
The output should be printed to stdout and must be a single string, which is the result of reordering the digits in \( s \) in ascending order while keeping the letters in their original positions.
## samplea1b3c2
a1b2c3