Codeforces Round 354 (Div. 2)
C
Vasya and String
Codeforces
1500
原题
← BD →
翻译中…

High school student Vasya got a string of length $*n*$ as a birthday present. This string consists of letters 'a' and 'b' only. Vasya denotes beauty of the string as the maximum length of a substring (consecutive subsequence) consisting of equal letters.

翻译中…

Vasya can change no more than $*k*$ characters of the original string. What is the maximum beauty of the string he can achieve?

翻译中…

Input

翻译中…

The first line of the input contains two integers $*n*$ and $*k*$ ($1 ≤ *n* ≤ 100 000, 0 ≤ *k* ≤ *n*$) — the length of the string and the maximum number of characters to change.

翻译中…

The second line contains the string, consisting of letters 'a' and 'b' only.

翻译中…

Output

翻译中…

Print the only integer — the maximum beauty of the string Vasya can achieve by changing no more than $*k*$ characters.

翻译中…

Note

翻译中…

In the first sample, Vasya can obtain both strings "aaaa" and "bbbb".

翻译中…

In the second sample, the optimal answer is obtained with the string "aaaaabaa" or with the string "aabaaaaa".

翻译中…

样例

Input #1
4 2
abba
Output #1
4
InputCopy OutputCopy
Input #2
8 1
aabaabaa
Output #2
5
InputCopy OutputCopy
题目信息
题号
676C
时间限制
1 s
内存限制
256 MB
标签
二分
动态规划
字符串
双指针

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。