BETA
School Problem's Submission isn't counted in score!

Submissions: 1238 Accuracy:

32.47%

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 Input/Output Examples Use 'Expected Output' option **

Contributor: Prithwish Dasgupta

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

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