#C14429. Move Digits to the End

    ID: 44077 Type: Default 1000ms 256MiB

Move Digits to the End

Move Digits to the End

You are given a string s that consists of alphanumeric characters and special symbols. Your task is to relocate all the digit characters to the end of the string while maintaining the relative order of both the non-digit characters and the digits.

In other words, if we denote the input string as s and split it into two sequences:

  • A sequence of non-digit characters, L.
  • A sequence of digit characters, D.

Then the required output is L concatenated with D.

This can be thought of as a partitioning problem where digits and non-digits must be separated while preserving their order: \[ \text{Output} = L + D \]

It is guaranteed that the input will be a single string. Special characters (other than digits) remain in their original order.

inputFormat

The input consists of a single line containing a string s.

You can assume that s may include letters, digits, and special characters.

outputFormat

Output a single line containing the transformed string where all digit characters have been moved to the end, preserving the relative order of other characters.

## sample
a3bc2d1!@
abcd!@321