CF1980A.Problem Generator

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Problem Generator

Vlad is planning to hold mm rounds next month. Each round should contain one problem of difficulty levels 'A', 'B', 'C', 'D', 'E', 'F', and 'G'.

Vlad already has a bank of nn problems, where the ii-th problem has a difficulty level of aia_i. There may not be enough of these problems, so he may have to come up with a few more problems.

Vlad wants to come up with as few problems as possible, so he asks you to find the minimum number of problems he needs to come up with in order to hold mm rounds.

For example, if m=1m=1, n=10n = 10, a=a= 'BGECDCBDED', then he needs to come up with two problems: one of difficulty level 'A' and one of difficulty level 'F'.

Input

The first line contains a single integer tt (1t10001 \le t \le 1000) — the number of test cases.

The first line of each test case contains two integers nn and mm (1n501 \le n \le 50, 1m51 \le m \le 5) — the number of problems in the bank and the number of upcoming rounds, respectively.

The second line of each test case contains a string aa of nn characters from 'A' to 'G' — the difficulties of the problems in the bank.

Output

For each test case, output a single integer — the minimum number of problems that need to come up with to hold mm rounds.

Samples

3
10 1
BGECDCBDED
10 2
BGECDCBDED
9 1
BBCDEFFGG
2
5
1

在线编程 IDE

建议全屏模式获得最佳体验