#C9616. Rearrange String
Rearrange String
Rearrange String
Given a string consisting of digits and letters, rearrange the string such that all digits appear first followed by all letters. Both the digits and the letters must appear in the same order as they appeared in the original string.
Note: The input string may contain only digits, only letters, or a mix of both. If the string is empty, the output should be an empty string.
The solution should read input from stdin and output the result to stdout.
inputFormat
The input consists of a single line containing a non-empty string s
, which consists only of digits (0-9) and letters (a-z, A-Z).
outputFormat
Output a single line containing the rearranged string such that all digits appear first in the order they occur in the input, followed by all letters in their original order.
## samplea1b2c3d4
1234abcd