#C5543. Segregate Alphabets and Digits

    ID: 49204 Type: Default 1000ms 256MiB

Segregate Alphabets and Digits

Segregate Alphabets and Digits

Given a list of strings, your task is to segregate alphabets and digits from each string. For every input string, extract two substrings: one comprising all the alphabetical characters and the other comprising all the digit characters, both in their original order. For example, given the string a1b2, the output should be ab 12.

inputFormat

The first line of input contains an integer T, denoting the number of test cases. Each of the following T lines contains a non-empty string consisting solely of alphanumeric characters.

outputFormat

For each test case, output a single line. If both the alphabet and digit parts are non-empty, print them separated by a single space. If both parts are empty, print an empty line.## sample

1
a1b2c3
abc 123

</p>