Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

Pandit is playing a game of strings

Computer Science Sep 08, 2020

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

Expert Solution

For detailed step-by-step solution, place custom order now.
Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment