#K47247. Separate Numbers and Letters
Separate Numbers and Letters
Separate Numbers and Letters
In this problem, you are given a string containing both digits and letters. Your task is to rearrange the string so that all the digits come first followed by all the letters. It is important that the relative order of the digits and the letters remains unchanged. For example, given the string a1b2c3d4, you should output 1234abcd.
The problem can be mathematically expressed as: Given a string ( s ), let ( D = { s_i \mid s_i \text{ is a digit} } ) and ( L = { s_i \mid s_i \text{ is a letter} } ). The output string should be ( D \Vert L ), where ( \Vert ) denotes string concatenation.
inputFormat
The input consists of a single line containing a non-empty string composed of letters and digits. The string does not contain any spaces.
outputFormat
Output the transformed string, where all digits appear first, followed by all the letters, preserving their original relative order.## sample
a1b2c3d4
1234abcd