#K55302. Rearrange String: Letters First, Digits Later

    ID: 29945 Type: Default 1000ms 256MiB

Rearrange String: Letters First, Digits Later

Rearrange String: Letters First, Digits Later

You are given a string s consisting of letters and digits. Your task is to rearrange the string so that all the letters appear before any digits, while preserving the original order among the letters and among the digits.

This problem can be formally described using the following formula:

$$output = \text{letters}(s) + \text{digits}(s)$$

where \text{letters}(s) is the subsequence of all letter characters in s and \text{digits}(s) is the subsequence of all digit characters in s.

inputFormat

The input is read from standard input (stdin) and consists of multiple test cases. The first line of input contains an integer T (1 ≤ T ≤ 1000), the number of test cases. Each of the following T lines contains a nonempty string s composed exclusively of letters and digits.

outputFormat

For each test case, output the rearranged string on a separate line to standard output (stdout).

## sample
2
a1b2c3
123abc
abc123

abc123

</p>