#C6593. Sort Mixed String Characters
Sort Mixed String Characters
Sort Mixed String Characters
Problem Description:
You are given a string containing lowercase letters and digits. Your task is to sort the letters in alphabetical order and the digits in increasing numerical order. The resulting string should consist of the sorted letters first followed by the sorted digits.
For clarity, the sorting orders are defined as follows:
( a < b < c < \cdots < z ) for letters and ( 0 < 1 < 2 < \cdots < 9 ) for digits.
Example:
If the input string is a3c1b2
, the output should be abc123
.
inputFormat
Input Format:
A single line containing a non-empty string composed of lowercase letters and digits only. The input is provided via standard input (stdin).
outputFormat
Output Format:
A single line which is the sorted string. All letters are sorted in alphabetical order and appear first, followed by all digits sorted in increasing order. The output should be printed to standard output (stdout).## sample
a3c1b2
abc123