

You are given ‘str’ = ‘A1 person3 good2’, in this we can see the ordering of the words like ‘A’, ‘good’ ‘person’ according to the suffix number. Hence the answer string is ‘A good person’.
The first line of input contains a single integer ‘T’, representing the number of test cases.
The first line of each test case contains a string ‘str’ representing the given string.
For each test case, print a single string representing the sorted string.
Print a separate line for each test case.
1 <= T <= 10
1 <= |str| <= 10^6
‘str’ will contain upper and lower case characters of the English alphabet.
‘str’ will not contain more than 9 words.
Time Limit: 1 sec.
You do not need to print anything. It has already been taken care of. Just implement the given function.
In this approach, we will separate the words from the sentence and sort them according to the suffix number at the end of the word. We will create an array of pairs with the first element of the pair as the index and the second element as the word. Then after sorting the array we can simply join all the second elements of the pairs in the array to a string and separate them by space.