Tim buy a string of  length N from his friend which consist of  ‘d’ and ‘u’ letters only
,but now Tim wants to sell the string at maximum cost.  
The maximum cost of string is defined as the maximum length of a Substring (consecutive subsequence) consisting of equal letters.
Tim can change at most P characters of string (‘d’ to ‘u’   and   ‘u’ to ‘d’) you have to find out the maximum cost of string?

-----Input:-----
- First line will contain $N$ and $P$ .
- Second line will contain the String $S$.

-----Output:-----
Maximum cost of string S.

-----Constraints-----
- $1 \leq N\leq 10^5$
- $0 \leq P \leq N$

-----Sample Input 1:-----
4  2
$duud$

-----Sample Output 1:-----
4

-----Sample Input 2 :-----
10 1
$dduddudddu$

-----Sample Output 2:-----
6

-----EXPLANATION:-----
In the first sample input , We can obtain both strings $dddd$ and $uuuu$ .
In the second sample, the optimal answer is obtained with the string $dddddudd$ or with the string $dduddddd$

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
(n, p) = map(int, input().split())
s = input()
d = s.count('d')
u = s.count('u')
if d <= p or u <= p:
	print(n)
elif d >= u:
	c = 0
	l = 0
	i = 0
	ii = -1
	pp = p
	while i < n:
		if s[i] == 'u' and ii == -1:
			ii = i
		if pp == 0 and s[i] == 'u':
			c = max(c, l)
			i = ii
			ii = -1
			l = -1
			pp = p
		elif s[i] == 'u':
			pp -= 1
		i += 1
		l += 1
	print(max(c, l))
else:
	c = 0
	l = 0
	i = 0
	ii = -1
	pp = p
	while i < n:
		if s[i] == 'd' and ii == -1:
			ii = i
		if pp == 0 and s[i] == 'd':
			c = max(c, l)
			i = ii
			ii = -1
			l = -1
			pp = p
		elif s[i] == 'd':
			pp -= 1
		i += 1
		l += 1
	print(max(c, l))


(N, P) = map(int, input().split())
S = [i == 'd' for i in input().strip()]

def calcMax(ar):
	j = c = ans = 0
	for i in range(len(ar)):
		while j < len(ar) and c + ar[j] <= P:
			c += ar[j]
			j += 1
		ans = max(ans, j - i)
		c -= ar[i]
	return ans
print(max(calcMax(S), calcMax([not _ for _ in S])))


def findLen(A, n, k, ch):
	maxlen = 1
	cnt = 0
	l = 0
	r = 0
	while r < n:
		if A[r] != ch:
			cnt += 1
		while cnt > k:
			if A[l] != ch:
				cnt -= 1
			l += 1
		maxlen = max(maxlen, r - l + 1)
		r += 1
	return maxlen

def answer(A, n, k):
	maxlen = 1
	for i in range(26):
		maxlen = max(maxlen, findLen(A, n, k, chr(i + ord('A'))))
		maxlen = max(maxlen, findLen(A, n, k, chr(i + ord('a'))))
	return maxlen
(n, k) = map(int, input().split())
s = str(input())
print(answer(s, n, k))