Jon and string
Submissions: 560   Accuracy:

29.15%

  Difficulty: Easy   Marks: 2

Ygritte says "Jon knows nothing". But Jon knows something. She gives a chance to Jon to prove it. She gives a string S to Jon and ask him to 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. Help Jon to prove that he knows something.

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....

 

 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Arun Tyagi
Author: arun03


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.



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

to report an issue on this page.