Super String

3.2

36 votes
Easy
Problem

Kevin has a string S that consists of lowercase English letters. Also he can perform the following operation in one minute:

  • Choose some L,R such that 1LRlength(S),L1  or  Rlength(S) and remove substring [L,R] from S. It means that string S=S1S2Slength(S) becomes S1S2SL1SR+1Slength(S).

Kevin has at most K minutes to perform this operations. He decides that the string is super if it is the lexicographically smallest among all possible strings that he can get. Your task is to help Kevin and find this lexicographically smallest string.

Input format:

The first line of input will contain an integer T, denoting the number of test cases.
Each test case starts with 2 numbers N and K - length of S and the number of minutes Kevin has. Next line contains string S.

Output format:

For every test case output lexicographically smallest string that Kevin can get.

Constraints:

  • 1T10
  • 1N,K1000
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Kevin get string "eow" after the first operation and "e" after the second.

Editor Image

?