Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
A Game of Strings Pandit is playing a game of strings. As it is well known that he isn't very bright. So he needs your help in winning this game. The game is very simple. You are given a string S of l
A Game of Strings
Pandit is playing a game of strings. As it is well known that he isn't very bright. So he needs your help in winning this game.
The game is very simple. You are given a string S of length N and an integer K. You have to print first K occurences(if for any character count < K then print them all) of every character in the given order.
INPUT FORMAT
First line contains T, number of testcases.
1≤T≤100
First line of each testcase contains 2 integers N and K.
1≤N≤10^5
1≤K≤10^4
Second line contains the string S, comprising of only lowercase alphabets.
OUTPUT FORMAT
Print the required string.
SAMPLE INPUT
1
10 3
abcaacbccb
SAMPLE OUTPUT
abcaacbcb
Write a java program for this....///