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. The strings S1, S2 and S3 should have characters in same order as they appear in 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.
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.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.