StringSliding Window
You may change at most k characters of the string to any uppercase letter. After the changes, what is the length of the longest substring made of a single repeated letter?
Input
Line 1: the string s of uppercase letters. Line 2: the integer k.
Output
Print the length of the longest substring you can make with one repeated letter.
Constraints
1 <= length of s <= 5 * 10^4 0 <= k <= length of s
Example 1
Input
ABAB 2
Output
4
Change both Bs (or both As) to get a run of 4.
Example 2
Input
AABABBA 1
Output
4
Change one letter to get AAAA or BBBB of length 4.