K Frequency
You are given a string S made of lowercase English alphabets. Find the character
having the kthe largest frequency.
If there is more than one character that meets the condition, print the smallest
one.
If there is no character that meets the condition print -1.
Input format
The first line consists of a single integer, T. denoting the number of test
cases.
The first line of each test case consists of a single string made of lower case
English alphabets.
The second line of each test case consists of a single integer denoting k.
Output format
Print the required answer for each test case in a new line.
Constraints
1<T < 10
1 SISI < 10
1
k
26
Sample Input
Sample Output
aabcd
abc
Answers
Answered by
0
Answer:
efgki IV bh a bit more about what are your thoughts and feelings about 3_|%$^&543774###@?"%-:
Similar questions