805. Kartik Bhaiya's Perfectness
0
Medium
Kartik Bhaiya has a string composed of only 'a' and 'b' characters. He defines the perfectness of a string as the longest substring consisting of the same character. Kartik Bhaiya is given a number **k** which represents the maximum number of characters he can change. Determine the maximum perfectness he can achieve by changing no more than **k** characters.
Input Format
The first line contains an integer denoting the value of K.
The next line contains a string consisting only of 'a' and 'b' characters.
Output Format
A single integer representing the maximum achievable perfectness.
Example
Input
2
abba
Output
4
Constraints
2 ≤ N ≤ 10^6
Loading...
View Submissions
Console