#K47672. Lexicographically Smallest String
Lexicographically Smallest String
Lexicographically Smallest String
Given a string S
consisting of lowercase English letters, you are allowed to rearrange the characters arbitrarily. Your task is to determine the lexicographically smallest string that can be obtained after performing any number of such operations.
In other words, sort the characters of the input string in increasing order. Formally, if the input string is \( S \), you must output \( S' \) such that \( S' \) is a permutation of \( S \) and \( S' = sorted(S) \).
inputFormat
The first line contains an integer T
representing the number of test cases. Each of the following T
lines contains a string S
consisting of lowercase English letters only.
outputFormat
For each test case, print the lexicographically smallest string that can be obtained by rearranging the characters of the corresponding input string. Each result should be printed on a new line.
## sample2
cbad
dcba
abcd
abcd
</p>