Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Pandit is playing a game of strings

Pandit is playing a game of strings

Computer Science

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

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions