Sort a String (GFG)

 Given a string consisting of lowercase letters, arrange all its letters in ascending order. 

Input:
The first line of the input contains T, denoting number of testcases. Then follows description of each testcase. The first line of the testcase contains positive integer N denoting the length of string. The second line contains the string.

Output:
For each testcase, output the sorted string.

Constraints:
1 <= T <= 100
1 <= N <= 100

Example:
Input:
1
5
edcab

Output:
abcde

Explanation:
Testcase 1:
 The given string in sorted order of its letters is: abcde


OUTPUT:

t=int(input())

for i in range (t):

    n=int(input())

    j=''.join(sorted(input()))

    print(j)

Comments

Popular posts from this blog

Sort in specific order (GFG)

Chef and Remissness Problem Code: REMISS (CodeChef)

Short Notes Of computer Network