BETA

Difficulty Level:

Easy

Total Submissions: 85 Accuracy:

15.29%

Maximum Sub-String after at most K changes
     

We have a string of length n, which consist only UPPER and LOWER CASE characters and we have a number k (always less than n and greater than 0). We can make at most k changes in our string such that we can get a sub-string of maximum length which have all same characters.

Input:
The first line of the input contains an integer T which denotes the number of test cases to follow. Each test case contains space separated 2 integers n and k. Next line has a string of length n. 

Output:
Print an integer which denotes the maximum length possible.

Constraints:
1<=T<=100
1<=n,k<=100000
1<=|S|<=100000​​

Example:
Input:

2
5 2
ABABA
6 4
HHHHHH

Output:
5
6

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Shashwat Jain

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.