Jon and string
Easy Accuracy: 31.21% Submissions: 604 Points: 2

Given a string S sort it in the following manner. Sorted string must contain a vowel as first letter and a consonant as next letter and so on OR a consonant as first letter and a vowel as next letter and so on, depending on the string. If there is no vowel left then print the remaining consonant in ascending order and vice versa.

Note: Order of vowel must be a->e->i->o->u and order of consonant must be b->c->d... and so on.

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

Output:
For each test case, in a new line print the sorted string.

Constraints:
1<=T<=200
1<=S<=1000


Example:
Input:
3
abcdei
bcadefgh
aabcdjkl


Output:
abecid
bacedfgh
abacdjkl

Explanation:
In 1st test case
'a' (Vowel) came first so the pattern of sorted string is  vcvcvcvc... 

For 2nd test case
'b' (consonant) came first so the pattern of sorted string is cvcvcvcv....

 

 

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.