← Home
write a go solution for C. Turtle and Good Pairstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTurtle gives you a string s, consisting of lowercase Latin letters.Turtle considers a pair of integers (i,j) (1<=i<j<=n) to be a pleasant pair if and only if there exists an integer k such that i<=k<j and both of the following two conditions hold:  s_knes_k+1;  s_knes_i or s_k+1nes_j. Besides, Turtle considers a pair of integers (i,j) (1<=i<j<=n) to be a good pair if and only if s_i=s_j or (i,j) is a pleasant pair.Turtle wants to reorder the string s so that the number of good pairs is maximized. Please help him!InputEach test contains multiple test cases. The first line contains the number of test cases t (1<=t<=10^4). The description of the test cases follows.The first line of each test case contains a single integer n (2<=n<=2*10^5) — the length of the string.The second line of each test case contains a string s of length n, consisting of lowercase Latin letters.It is guaranteed that the sum of n over all test cases does not exceed 2*10^5.OutputFor each test case, output the string s after reordering so that the number of good pairs is maximized. If there are multiple answers, print any of them.ExampleInput53abc5edddf6turtle8pppppppp10codeforcesOutputacb
ddedf
urtlet
pppppppp
codeforces
NoteIn the first test case, (1,3) is a good pair in the reordered string. It can be seen that we can't reorder the string so that the number of good pairs is greater than 1. bac and cab can also be the answer.In the second test case, (1,2), (1,4), (1,5), (2,4), (2,5), (3,5) are good pairs in the reordered string. efddd can also be the answer.. Output only the code with no comments, explanation, or additional text.