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.
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.
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.
For each test case in a new line print the required output.
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.