#C13337. Sort Numbers Keeping Letters
Sort Numbers Keeping Letters
Sort Numbers Keeping Letters
Your task is to process a semicolon-separated string which contains a mix of numerical and alphabetical entries. You must sort only the numerical values in ascending order while keeping the alphabetical characters in their original positions. The input is provided as a single line and the output should be the transformed string.
For instance, if the input string is 5;a;3;b;9;c;6
, then the output should be 3;a;5;b;6;c;9
.
Note: If no numerical values are present or the string is empty, the output remains the same.
inputFormat
The input is read from standard input (stdin
) as a single line of text. This line will be a semicolon-separated string containing numbers and alphabetic characters.
outputFormat
Output the resulting semicolon-separated string, where the numeric values have been sorted in ascending order. The non-numeric characters must remain in their original positions. The result should be written to standard output (stdout
).
5;a;3;b;9;c;6
3;a;5;b;6;c;9