#K65102. Lexicographically Smallest String
Lexicographically Smallest String
Lexicographically Smallest String
Given a string s, you are allowed to perform the following operation any number of times: choose any character from s and replace all characters in s with that chosen character. Your task is to determine the lexicographically smallest string that can be obtained through these operations. Formally, if ( s = s_1s_2\dots s_n ) and ( c = \min{s_1, s_2, \dots, s_n} ), then the answer is the string consisting of character ( c ) repeated ( n ) times.
Note: The lexicographical order is defined in the usual manner, i.e., 'a' is less than 'b', 'b' is less than 'c', and so on.
inputFormat
The first line contains an integer ( T ) representing the number of test cases. Each of the following ( T ) lines contains a single string ( s ) consisting of lowercase English letters.
outputFormat
For each test case, output the lexicographically smallest string obtainable on a new line.## sample
3
abba
a
xyz
aaaa
a
xxx
</p>