Substring ABC

Substring ABC

Time Limit: 1.0 s

Memory Limit: 256.0 MB

Description

You are given a string S and the length of the string is N. You need to perform at most K operations (Possibly zero) of the string S.
In each operation,
You can choose an index \(i\), \(1<= i<= N\), right shift its character \(S[i]\).
Right shift means,

'a' becomes 'b',
'b' becomes 'c',
'c' becomes 'd',
...
'z' becomes 'a'.
After perfroming above operation on string S, find the occurrence of "abc" as a substring.
You need to perform operation such way that, total occurrence of "abc" is as maximum as possible.

Input

First line T, the number of test cases.
In each test case, first line two positive integers N and K.
Second line, a string S, the length of string is N.

\(1<=T<=500\)
\(1<= N <= 5000\)
\(1<= K <= 2 * 10^5\)
String S contains only lowercase alphabets.
Sum of N overall test case doesn't exceed 5000.

Output

In each test case, print the occurrence of abc of the string S.

Sample

Input Output
2
7 3
azcpaac
6 12
abczzz
2
2

First test case :

Information

ID
1100
Difficulty
6
Category
DP | String_Processing Click to Show
Tags
# Submissions
84
Accepted
24
Accepted Ratio
29%
Uploaded By

Related

In following contests:

Brain Booster #6