Lexicographically Smallest String

Lexicographically Smallest String

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Time Limit: 1.0 s

Memory Limit: 256.0 MB

You are given a string S containing n characters. You need to find out the lexicographically smallest string after performing at most m operations (possibly zero).

In each operation, you can select two indices i and j (\(1 \le i,j \le n\)), and swap their characters. For example, for S = "abaa", if you select indices 1 and 2, then swap(S[1], S[2]). After the swap, the string becomes S="baaa".

Input

First line contains a positive integers T, which denotes number of test cases.

In each test case, the first line contains n and m, the length of the string and the number of operations, respectively.

The second line contains the string S of length n.

\(1 \le T \le 10^4\)
\(1 \le n \le 10^5\)
\(1 \le m \le 10^9\)

Note: String S contains english lowercase alphabet only. It is guranteed that sum of n over all test cases doesn't exceed \(2 \times 10^5\).

Output

For each test case, print the lexicographically smallest string S after performing at most m operations.

Sample

Input Output
2
4 2
bbaa
5 1
abbac
aabb
aabbc

Sylhet ICPC 2024 Collaborative Challenge: Episode 2

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
9
Start at
2024-10-30 08:45
End at
2024-10-30 12:45
Duration
4.0 hour(s)
Host
Partic.
18