#C14365. Sort Letters and Digits
Sort Letters and Digits
Sort Letters and Digits
Given a string containing both letters and digits, your task is to sort the letters in alphabetical order and the digits in ascending order while preserving the original positions of letters and digits. That is, the positions in the output corresponding to letters and digits respectively remain the same as in the input.
Example: For the input "a1d3b4c2", the expected output is "a1b2c3d4".
The problem requires that you read the input from standard input and output the result to standard output.
inputFormat
The input consists of a single line string that may contain both letters and digits.
outputFormat
Output a single line string where all letters are sorted alphabetically and all digits are sorted in ascending order, while the positions of letters and digits remain as in the original string.
## samplea1d3b4c2
a1b2c3d4