BETA
Split Strings
Submissions: 560   Accuracy:

54.82%

  Difficulty: Basic
     

Given a string S which consists of alphabets , numbers and special characters. You need to write a program to split the strings in three different strings S1, S2 and S3 such that the string S1 will contain all the alphabets present in S , the string S2 will contain all the numbers present in S and S3 will contain all special characters present in S.

Input:
First line of input contains a single integer T which denotes the number of test cases. First line of each test case contains a String S of alphabets, numbers and special characters.
Output:
For each test case, In the first line print the string S1 which contains all the alphabets of S. In the second line print the string S2 which contains all the numbers. In the third line print the string S3 which contains all the special characters present in S.

Constraints:
1<=T<=100
3<=Length(S)<=1000

Example:
Input:

2
geeks01for02geeks03!!!
**Docoding123456789everyday##
Output:
geeksforgeeks
010203
!!!
Docodingeveryday
123456789
**##

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harsh Agarwal
Author: harsh.agarwal0


Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.