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….///

The post a java program appeared first on Homework Aider.


What Students Are Saying About Us

.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐
"Honestly, I was afraid to send my paper to you, but you proved you are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"

.......... Customer ID: 11***| Rating: ⭐⭐⭐⭐⭐
"This company is the best there is. They saved me so many times, I cannot even keep count. Now I recommend it to all my friends, and none of them have complained about it. The writers here are excellent."


"Order a custom Paper on Similar Assignment at essayfount.com! No Plagiarism! Enjoy 20% Discount!"