Problem title
Difficulty
Avg time to solve

Rearrange Array
Easy
15 mins
Find the Winner
Easy
10 mins
Custom Sort String
Easy
10 mins
Battalions and tanks
Moderate
10 mins
Mirror String
Easy
15 mins
Find the K-th Smallest Element in Array
Easy
10 mins
Median of a row wise sorted matrix
Moderate
30 mins
Minimum Number Of Swaps For Bracket Balancing
Moderate
15 mins
Minimum Rotations
Easy
10 mins
Rotate DLL
Moderate
10 mins
1

String Sort

Difficulty: EASY
Contributed By

Problem Statement

You are given a string ‘S’ consisting of lowercase English alphabets from ‘a’ to ‘z’. You have to print the string in sorted order.

Input Format :
The first line of the input contains a single integer 'T', representing the number of test cases.

The first line of each test case contains a string ‘S’ denoting a string.
Example :
S = ‘bbccdefbbaa’

We sort the string lexicographically or in dictionary order.

Output is: ‘aabbbbccdef’.
Output format :
For each test case, output the sorted string.

Print the output of each test case in a new line.
Note :
You don’t need to print anything. It has already been taken care of. Just implement the given function.
Constraints :
1 <= T <= 10 
1 <= S.length <= 10^5
‘a’ <= S[i] <= ‘z’

Time Limit: 1 sec
Sample Input 1 :
2
kbfhh
jjkiia
Sample Output 1 :
bfhhk
aiijjk   
Explanation Of Sample Input 1 :
For test case 1 we have, 

The sorted string in lexicographical order is: bfhhk

For test case 2 we have,

The sorted string in lexicographical order is: aiijjk
Sample Input 2 :
2
dbahff
ccbbj
Sample Output 2 :
abdffh
bbccj 
Reset Code
Full screen
copy-code
Console