#C12846. Rearrange String Digits
Rearrange String Digits
Rearrange String Digits
Given a string S containing digits, letters, and special characters, your task is to rearrange the string so that all the digits are moved to the end while preserving the original order of the non-digit characters and the digits.
Formally, if the input string is represented as \( S = s_1 s_2 \ldots s_n \), then let \( N \) be the sequence of non-digit characters and \( D \) be the sequence of digit characters in the order they appear. You need to output the string \( N + D \).
For example, if \( S = "a1b2c3!" \), then the output should be "abc!123".
inputFormat
The input consists of a single line string S that may contain digits, letters, and special characters.
outputFormat
Output a single line string that is the result of rearranging S so that all digits are moved to the end, while the relative ordering of non-digit characters and digits remains unchanged.
## samplea1b2c3!
abc!123