SP21083 LEXSTR - Lexicographically Smallest
Description
Taplu and Abhishar loved playing scrabble. One day they thought of inventing a new game using alphabet tiles. Abhishar wrote a string using tiles and gave a set of pairs (i,j) to Taplu. Pair “i, j” (0 based indexing) means that Taplu can swap the i’th and j’th tile in the string any number of times. He then asks Taplu to give the lexicographically smallest string that can be produced by doing any number of swaps on the original string.
Input Format
First line contains T(1
Output Format
For each testcase output the lexicographically smallest string that can be made from the initial string.