BETA
This is a school problem. Successful submissions of this are not counted in user ratings.

Submissions : 1115 Accuracy :

31.21

Unusual String Sort
       

Babul likes to play with string and he always tries do something new with it. This time he found a very typical way to sort a string. What he did is that he took a string composed of both lowercase and uppercase letters and sorted it in such a manner such that the uppercase and lowercase letter comes in an alternate manner but in sorted way, but Babul has to do some other stuffs also, so he needs your help to complete this job as fast as possible.

Example:

Input: bAwutndekWEdkd

Output: AbEdWddekkntuw

Explanation:
Here we can see that letter ‘A’,’E’,’W’ are sorted as well as letters “b,d,d,d,e,k,k,n,t,u,w” are sorted but both appears alternately in the string as far as possible.


Input:
The first line of input contains an integer T denoting the no of test cases.Then T test cases follow. Each line of test case will contain a string S.

 

Output:
For each test case in a new line print the required output.
 

Constraints:
1<=T<=100
1<=|S|<=1000


Example:
Input:

2
bAwutndekWEdkd
AFBRi

Output:
AbEdWddekkntuw
AiBFR

 

 

**For More Examples Use Expected Output**


Contributor: Prithwish Dasgupta

Set Default Code

					   
Result:
It is recommended to test your code before clicking 'Submit' button!



                   



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