You have been given a string s as input and you have to print it's modified form.A string is modified in the following way:-
All the duplicates are removed from the original string and the modified string contains the characters in the order of their frequency .i.e, character with the higher frequency should come first than the character with the lower frequency in the modified string and if the two characters have the same frequency in the original string then it should occur in alphabetical order in the new modified string.
First line of input contains an integer T denoting the number of test cases.Each test case consist of a single line containing a string s to be modified.
Print the modified string in a new line.
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.