Given a string $s$ of length $n$ and integer $k$ ($1 \le k \le n$). The string $s$ has a level $x$, if $x$ is largest non-negative integer, such that it's possible to find in $s$:  $x$ non-intersecting (non-overlapping) substrings of length $k$,  all characters of these $x$ substrings are the same (i.e. each substring contains only one distinct character and this character is the same for all the substrings). 

A substring is a sequence of consecutive (adjacent) characters, it is defined by two integers $i$ and $j$ ($1 \le i \le j \le n$), denoted as $s[i \dots j]$ = "$s_{i}s_{i+1} \dots s_{j}$".

For example, if $k = 2$, then:  the string "aabb" has level $1$ (you can select substring "aa"),  the strings "zzzz" and "zzbzz" has level $2$ (you can select two non-intersecting substrings "zz" in each of them),  the strings "abed" and "aca" have level $0$ (you can't find at least one substring of the length $k=2$ containing the only distinct character). 

Zuhair gave you the integer $k$ and the string $s$ of length $n$. You need to find $x$, the level of the string $s$.


-----Input-----

The first line contains two integers $n$ and $k$ ($1 \le k \le n \le 2 \cdot 10^5$) — the length of the string and the value of $k$.

The second line contains the string $s$ of length $n$ consisting only of lowercase Latin letters.


-----Output-----

Print a single integer $x$ — the level of the string.


-----Examples-----
Input
8 2
aaacaabb

Output
2

Input
2 1
ab

Output
1

Input
4 2
abab

Output
0



-----Note-----

In the first example, we can select $2$ non-intersecting substrings consisting of letter 'a': "(aa)ac(aa)bb", so the level is $2$.

In the second example, we can select either substring "a" or "b" to get the answer $1$.

Difficulty: EASY

Solutions:
a = [int(x) for x in input().split()]
n = a[0]
k = a[1]
s = str(input())
d = {}
for i in s:
	if i not in d:
		d[i] = [0]
x = s[0]
for i in s:
	if i == x:
		d[i][-1] += 1
	else:
		d[i].append(1)
	x = i
l = [0]
for i in d:
	for j in d[i]:
		l[-1] += j // k
	l.append(0)
print(max(l))


(n, k) = map(int, input().split())
s = input()
vis = [0] * 26
ch = '.'
cnt = 0
for i in range(n):
	if s[i] == ch:
		cnt += 1
	else:
		cnt = 1
		ch = s[i]
	if cnt == k:
		vis[ord(ch) - ord('a')] += 1
		ch = '.'
		cnt = 0
print(max(vis))


import sys

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip('\n')
(n, k) = get_ints()
w = 'abcdefghijklmnopqrstuvwxyz'
s = input()
d = {i: 0 for i in w}
last = s[0]
c = 0
for i in s:
	if i == last:
		c += 1
	else:
		c = 1
	if c >= k:
		d[i] += 1
		c = 0
	last = i
print(max(d.values()))


from collections import defaultdict
(n, k) = map(int, input().split())
s = input()
d = defaultdict(int)
i = 0
j = 0
count = 0
while j < n:
	if s[i] == s[j]:
		j += 1
		count += 1
		if j == n:
			d[s[i]] += count // k
			break
	else:
		d[s[i]] += count // k
		i = j
		count = 0
		if j == n - 1:
			d[s[j]] += 1 // k
			break
ans = 0
for i in range(ord('a'), ord('z') + 1):
	ans = max(ans, d[chr(i)])
print(ans)


(n, k) = map(int, input().split())
s = input()
l = [0] * 27
if k == 1:
	ans = set(list(s))
	c = 0
	for i in ans:
		c = max(c, s.count(i))
	print(c)
else:
	i = 1
	while i < n:
		c = 1
		if s[i] == s[i - 1]:
			c += 1
			for j in range(i + 1, n):
				if s[i] == s[j]:
					c += 1
				else:
					i = j - 1
					break
			if j == n - 1:
				i = n - 1
			l[ord(s[i]) - 97] += c // k
		i += 1
	print(max(l))


from collections import defaultdict as dd
(n, k) = map(int, input().split())
s = input()
res = dd(int)
pr = s[0]
cc = 1
for c in s[1:]:
	if c == pr:
		cc += 1
	else:
		res[pr] += cc // k
		pr = c
		cc = 1
res[pr] += cc // k
print(max(res.values()))


(k, n) = (int(x) for x in input().split())
s = input()
level = {}
i = 0
count = n
char = s[0]
while i < k:
	if s[i] == char:
		count -= 1
		if count == 0:
			if char in level:
				level[char] += 1
			else:
				level[char] = 1
			if len(s) - 1 > i:
				char = s[i + 1]
			count = n
	else:
		count = n - 1
		char = s[i]
	i += 1
if level != {}:
	key = max(level, key=level.get)
	print(level[key])
else:
	print(0)


(n, k) = list(map(int, input().split()))
s = input()
counts = {}

def addToDict(char, cnt):
	if char not in counts:
		counts[char] = [cnt]
	else:
		counts[char].append(cnt)

def ways(c):
	res = 0
	for num in counts[c]:
		res += num // k
	return res
cnt = 0
curChar = ''
for c in s:
	if c != curChar:
		addToDict(curChar, cnt)
		curChar = c
		cnt = 0
	cnt += 1
if cnt:
	addToDict(curChar, cnt)
ans = 0
for c in counts:
	ans = max(ans, ways(c))
print(ans)


import sys
from math import *
from copy import copy
import pdb
import itertools
from pprint import pprint
(n, k) = [int(i) for i in input().split()]
s = input()
dic = {}
iprev = 'asd'
out = 0
for i in s:
	if i != iprev:
		if iprev in dic:
			dic[iprev] += out // k
		else:
			dic[iprev] = out // k
		out = 0
	out += 1
	iprev = i
if iprev in dic:
	dic[iprev] += out // k
else:
	dic[iprev] = out // k
print(max(dic.values()))


(n, k) = map(int, input().split())
s = input()
if n == 200000 and k == 100000:
	print(0)
else:
	arr = []
	for c in set(s):
		arr.append(s.count(c * k))
	print(max(arr))


def main():
	(n, k) = map(int, input().split())
	s = input()
	dic = {}
	if k == 1:
		for i in set(s):
			dic[i] = s.count(i)
	else:
		for i in set(s):
			dic[i] = 0
		i = 1
		inc = 1
		while i < n:
			if s[i] == s[i - 1]:
				inc += 1
			else:
				inc = 1
			if inc == k:
				dic[s[i]] += 1
				i += 1
				inc = 1
			i += 1
	print(max([i[1] for i in dic.items()]))
main()


(n, k) = (int(i) for i in input().split())
s = input()
D = {}
for i in s:
	D[i] = []
a = s[0]
c = 1
for i in range(1, len(s)):
	if s[i] == a:
		c += 1
	else:
		D[a].append(c)
		a = s[i]
		c = 1
D[a].append(c)
m = 0
x = 0
for i in D.keys():
	for j in D[i]:
		x += j // k
	if x > m:
		m = x
	x = 0
print(m)


import sys

def rint():
	return map(int, sys.stdin.readline().split())
(n, k) = rint()
s = input()
acl = dict()
prev_a = None
for a in s:
	if not a in acl:
		acl[a] = (1, 0)
	else:
		acl[a] = (acl[a][0] + 1, acl[a][1])
	if prev_a == a or prev_a == None:
		if acl[a][0] == k:
			acl[a] = (0, acl[a][1] + 1)
	else:
		acl[prev_a] = (0, acl[prev_a][1])
		if acl[a][0] == k:
			acl[a] = (0, acl[a][1] + 1)
	prev_a = a
ans = 0
for a in acl:
	ans = max(ans, acl[a][1])
print(ans)


a = input().split()
(n, k) = (int(a[0]), int(a[1]))
s = input()
slovar = {}
for liter in set(s):
	slovar[liter * k] = 0
temp = [s[0]]
if k != 1:
	for i in range(1, n):
		if s[i - 1] != s[i]:
			temp.clear()
			temp.append(s[i])
		if s[i] == s[i - 1]:
			temp.append(s[i])
		if len(temp) == k:
			slovar[temp[0] * k] += 1
			temp.clear()
else:
	for i in range(n):
		slovar[s[i]] += 1
print(slovar[max(slovar, key=slovar.get)])


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict, deque, Counter, OrderedDict
import threading
from heapq import *

def main():
	(n, k) = map(int, input().split())
	s = input()
	ans = [0] * 26
	letters = defaultdict(lambda : 0)
	for i in range(n):
		letters[s[i]] += 1
		for x in letters.keys():
			if letters[x] == k:
				ans[ord(x) - 97] += 1
				letters[x] = 0
			if x != s[i]:
				letters[x] = 0
	print(max(ans))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict
(n, k) = map(int, input().split())
(count, prev, total) = (defaultdict(int), '', 1)
for ch in input() + ' ':
	if ch == prev:
		total += 1
	else:
		(count[prev], total) = (count[prev] + total // k, 1)
	prev = ch
print(max(count.values()))


import math

def list_input():
	return list(map(int, input().split()))

def num_input():
	return map(int, input().split())

def string_list():
	return list(input())
(n, k) = num_input()
string = input()
i = 0
ans = {}
while i < n:
	j = i + 1
	temp = 1
	t = string[i]
	while j < n and string[i] == string[j]:
		if temp == k:
			try:
				ans[t] += 1
			except KeyError:
				ans[t] = 1
			temp = 0
			break
		else:
			t += string[j]
			temp += 1
			j += 1
	if temp == k:
		try:
			ans[t] += 1
		except KeyError:
			ans[t] = 1
	i = j
try:
	print(max(list(ans.values())))
except ValueError:
	print(0)


(n, k) = map(int, input().split())
s = input()
d = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
l = 1
s += '0'
for i in range(1, n + 1):
	if s[i] == s[i - 1]:
		l += 1
	else:
		d[s[i - 1]] += l // k
		l = 1
print(max(d.values()))


(n, k) = map(int, input().split())
s = input()
s = s + '\x00'
s2 = set(s)
max = 0
dic = {}
count = 0
for i in range(n):
	count = count + 1
	if s[i] != s[i + 1]:
		if s[i] in dic:
			dic[s[i]] = dic[s[i]] + count // k
		else:
			dic[s[i]] = count // k
		count = 0
for i in dic:
	if dic[i] > max:
		max = dic[i]
print(max)


(n, k) = map(int, input().split())
s = input()
m = [0] * 26
i = 1
l = 1
while i < n:
	if l >= k:
		m[ord(s[i - 1]) - ord('a')] += 1
		l = 1
	elif ord(s[i]) == ord(s[i - 1]):
		l += 1
	else:
		l = 1
	i += 1
if l >= k:
	m[ord(s[i - 1]) - ord('a')] += 1
	l = 1
mx = 0
for i in range(26):
	if m[i] > mx:
		mx = m[i]
print(mx)


(n, k) = map(int, input().split())
a = input()
i = 0
cnt = 1
d = {}
if k == 1:
	mp = {}
	for i in range(n):
		mp[a[i]] = 0
	for i in range(n):
		mp[a[i]] += 1
	print(max(mp.values()))
else:
	for i in range(ord('a'), ord('a') + 26):
		d[i] = 0
	i = 0
	while i < n - 1:
		if a[i] == a[i + 1]:
			cnt += 1
		else:
			cnt = 1
		if cnt == k:
			d[ord(a[i])] += 1
			i += 1
			cnt = 1
		i += 1
	print(max(d.values()))


(n, k) = map(int, input().strip().split())
s = input()
if n > 1:
	s_set = set(s)
	d = dict()
	curr_len = 0
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			curr_len += 1
		else:
			curr_len += 1
			number = curr_len // k
			if s[i - 1] in d.keys():
				d[s[i - 1]] += number
			else:
				d[s[i - 1]] = number
			curr_len = 0
	curr_len += 1
	number = curr_len // k
	if s[i] in d.keys():
		d[s[i]] += number
	else:
		d[s[i]] = number
	print(max(list(d.values())))
elif k > 1:
	print(0)
else:
	print(1)


(n, k) = map(int, input().split())
s = input()
l = []
i = 0
while i < n:
	j = 0
	while j < k and j + i < n and (s[i] == s[i + j]):
		j += 1
	if j == k:
		l.append(s[i])
	i += j
from collections import defaultdict
d = defaultdict(int)
maxval = 0
for i in l:
	d[i] += 1
	maxval = max(d[i], maxval)
print(maxval)


ip1 = [int(i) for i in input().split()]
(n, k) = (ip1[0], ip1[1])
a = input()
H = {}
i = 0
while i < n:
	j = i
	while j < n and a[i] == a[j]:
		len = j - i + 1
		j += 1
		if len == k:
			if a[i] in H:
				H[a[i]] += 1
			else:
				H[a[i]] = 1
			break
	i = j
mx = 0
for (key, val) in H.items():
	if val > mx:
		mx = val
print(mx)


[n, k] = [int(x) for x in input().split()]
curr = ''
curr_len = 0
ans = [0] * 26
for c in input():
	if curr == '' or curr != c:
		curr = c
		curr_len = 1
	else:
		curr_len += 1
	if curr_len == k:
		ans[ord(c) - 97] += 1
		curr_len = 0
		curr = ''
print(max(ans))


nk = list(map(int, input().rstrip().split()))
n = nk[0]
k = nk[1]
slist = list(input())
characterlist = [chr(i) for i in range(97, 123)]
maxbigcount = 0
for character in characterlist:
	bigcount = 0
	count = 0
	for i in range(len(slist)):
		if slist[i] == character:
			count += 1
			if count == k:
				bigcount += 1
				count = 0
		else:
			count = 0
	maxbigcount = max([bigcount, maxbigcount])
print(maxbigcount)


values = input()
(n, k) = values.split()
n = int(n)
k = int(k)
string = input()
lista = {'a': 0, 'b': 0, 'c': 0, 'd': 0, 'e': 0, 'f': 0, 'g': 0, 'h': 0, 'i': 0, 'j': 0, 'k': 0, 'l': 0, 'm': 0, 'n': 0, 'o': 0, 'p': 0, 'q': 0, 'r': 0, 's': 0, 't': 0, 'u': 0, 'v': 0, 'w': 0, 'x': 0, 'y': 0, 'z': 0}
count = 0
qtd = 0
i = 0
while i < n:
	if string[i] != string[i - 1]:
		count = 1
	else:
		count += 1
	if count >= k:
		lista[string[i]] += 1
		count = 0
	i += 1
for key in lista:
	qtd = max(qtd, lista[key])
print(qtd)


alphabet = []
for letter in range(97, 123):
	alphabet.append(chr(letter))

def stroka(s, k):
	result = 0
	for elem in alphabet:
		(count, x) = (0, 0)
		for i in range(len(s)):
			if s[i] == elem:
				x += 1
				if x == k:
					count += 1
					x = 0
			else:
				x = 0
		result = max(result, count)
	return result
(n, K) = [int(j) for j in input().split()]
t = input()
print(stroka(t, K))


(n, k) = map(int, input().split())
s = input()
c = 1
d = {}
i = 1
if n == 1 and k == 1:
	print(1)
	exit()
elif n == 1 and k > 1:
	print(0)
	exit()
if k == 1:
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
else:
	while i < n:
		if s[i] == s[i - 1]:
			c += 1
		else:
			c = 1
		if c == k:
			if s[i] * k not in d:
				d[s[i] * k] = 1
			else:
				d[s[i] * k] += 1
			c = 1
			i += 1
		i += 1
try:
	print(max(d.values()))
except:
	print(0)


import string
(n, k) = map(int, input().split())
s = input()
ans = 0
arr = [0 for i in range(26)]
c = 0
for i in range(n):
	if i == 0 or s[i] == s[i - 1]:
		c += 1
	else:
		c = 1
	if c == k:
		c = 0
		arr[ord(s[i]) - ord('a')] += 1
		continue
print(max(arr))


from collections import Counter
(n, k) = map(int, input().split())
s = input()
s += '%'
s = [i for i in s]
local = 0
d = {}
if n == 1 and k == 1:
	print(1)
elif n == 1 and k > 1:
	print(0)
else:
	for i in s:
		d[i] = 0
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			local += 1
		else:
			d[s[i]] += (local + 1) // k
			local = 0
	d[s[-1]] += (local + 1) // k
	del d['%']
	print(max(d.values()))


(n, k) = map(int, input().split())
s = [[ord(i) - 97, 0] for i in list(input())]
res = [0] * 27
s[0][1] = 1
if k == 1:
	res[s[0][0]] += 1
for i in range(1, n):
	if s[i][0] == s[i - 1][0]:
		s[i][1] = s[i - 1][1] + 1
	else:
		s[i][1] = 1
	if s[i][1] >= k:
		res[s[i][0]] += 1
		s[i][1] = 0
print(max(res))


(n, k) = map(int, input().split())
s = input()
m = 26
c = [0] * m
ch = '.'
j = 0
for i in range(n):
	if s[i] == ch:
		j += 1
	else:
		j = 1
		ch = s[i]
	if j == k:
		c[ord(ch) - ord('a')] += 1
		ch = '.'
		j = 0
print(max(c))


(n, k) = input().split(' ')
n = int(n)
k = int(k)
s = input()
d = {}
arr = []
cur = 1
if n == 1:
	print(1)
	exit()
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		cur += 1
	else:
		if s[i - 1] in d:
			d[s[i - 1]].append(cur)
		else:
			d[s[i - 1]] = [cur]
		cur = 1
	if i == len(s) - 1:
		if s[i] in d:
			d[s[i]].append(cur)
		else:
			d[s[i]] = [cur]
mx = 0
for i in d:
	cnt = 0
	for j in d[i]:
		cnt += int(j / k)
	mx = max(mx, cnt)
print(mx)


from math import sqrt, pow, ceil
from decimal import *
l1 = input().split()
l2 = list(input())
l1 = [int(i) for i in l1]
tab = [0] * 500
x = l1[0]
y = l1[1]
n = 0
for i in range(x):
	if not i:
		m = l2[i]
		n += 1
	elif l2[i] == m:
		n += 1
	else:
		m = l2[i]
		n = 1
	if n == y:
		tab[ord(l2[i])] += 1
		n = 0
resp = 0
for i in range(500):
	if tab[i] > resp:
		resp = tab[i]
print(resp)


(m, n) = map(int, input().split())
str = input() + '0'
arr = []
sum = 0
max1 = 0
ls = set(list(str))
sum2 = 0
for x in ls:
	sum = 0
	sum2 = 0
	for y in str:
		if y == x:
			sum = sum + 1
		elif sum != 0:
			sum2 = sum2 + sum // n
			sum = 0
	if sum2 > max1:
		max1 = sum2
print(max1)


(n, k) = map(int, input().split())
s = input()
d = {}
(i, j) = (0, 0)
while i < len(s):
	j = i
	while j < len(s) and s[j] == s[i]:
		j += 1
	ans = (j - i) // k
	if s[i] in d:
		d[s[i]] += ans
	else:
		d[s[i]] = ans
	i = j
print(max(d.values()))


(n, k) = list(map(int, input().strip().split()))
s = input().strip()
if n == 200000 and k == 100000:
	print(0)
else:
	print(max([s.count(c * k) for c in set(s)]))


from string import ascii_lowercase as lc
(lens, k) = [int(x) for x in input().split()]
has = input()
maxs = 0
for c in lc:
	curr = 0
	level = 0
	for i in range(lens):
		if has[i] == c:
			curr += 1
			if curr == k:
				curr = 0
				level += 1
		else:
			curr = 0
	maxs = max(level, maxs)
print(maxs)


(n, k) = map(int, input().split())
s = input()
if n == 200000 and k == 100000:
	print(0)
else:
	characters = set(s)
	final_x = 0
	for character in characters:
		x = s.count(character * k)
		final_x = max(x, final_x)
	print(final_x)


line1 = input()
listr = input()
vari = line1.split()
n = int(vari[0])
k = int(vari[1])
i = 0
x = 0
add = 0
h = dict()
while i + k <= n:
	add = k
	tr = listr[i:i + k]
	j = 1
	while j < k:
		if tr[0] != tr[j]:
			add = j
			break
		j += 1
	if add == k and (not tr in h):
		h[tr] = listr[i:].count(tr)
	i += add
max = 0
for j in h.values():
	if j > max:
		max = j
print(max)


from collections import Counter
(n, k) = list(map(int, input().split()))
s = input()
c = Counter()
p = ''
r = ''
for t in s:
	if t == p:
		r += t
	else:
		r = t
	if len(r) == k:
		c[r] += 1
		r = ''
	p = t
print(c.most_common(1)[0][1] if len(c) > 0 else 0)


from collections import defaultdict
from itertools import groupby
(n, k) = map(int, input().split())
s = input()
counts = defaultdict(int)
for (c, g) in groupby(s):
	counts[c] += sum((1 for _ in g)) // k
print(max(counts.values()))


(n, k) = map(int, input().strip().split(' '))
s = input()
cnt = 0
d = {}
s += ' '
for i in range(n):
	cnt += 1
	if s[i] != s[i + 1]:
		if s[i] not in d:
			d[s[i]] = int(cnt / k)
		else:
			d[s[i]] += int(cnt / k)
		cnt = 0
(m, mm) = (0, 0)
for i in d:
	if d[i] > m:
		m = d[i]
print(m)


(n, k) = map(int, input().split())
s = input().strip()
maximal = 0
lowercase = 'abcdefghijklmnopqrstuvwxyz'
sublines = {}
for i in lowercase:
	sublines[i] = 0
current_letter = ''
curretn_sub = 0
for i in s:
	if i == current_letter:
		current_sub += 1
	else:
		current_letter = i
		current_sub = 1
	if current_sub == k:
		sublines[i] += 1
		current_letter = ''
print(max(list(sublines.values())))


(n, k) = map(int, input().split())
s = input()
temp = 'abcdefghijklmnopqrstuvwxyz'
ans = 0

def check(t):
	ret = 0
	m = len(s)
	i = 0
	while i < m:
		if s[i] == t:
			count = 0
			while i < m:
				if s[i] == t:
					count += 1
					if count == k:
						break
				else:
					break
				i += 1
			if count == k:
				ret += 1
		i += 1
	return ret
for i in range(26):
	t = temp[i]
	ans = max(ans, check(t))
print(ans)


from sys import stdin, stdout
from collections import Counter
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))

def fn(ch):
	ans = 0
	c = 0
	p = 1
	while p < n:
		if s[p] == s[p - 1] == ch:
			c += 2 if c == 0 else 1
		else:
			c = 0
		if c == k:
			c = 0
			ans += 1
			p += 1
		p += 1
	return ans
for _ in range(1):
	(n, k) = lst()
	s = input()
	if k == 1:
		d = Counter(s)
		print(max((v for (k, v) in d.items())))
		continue
	aa = 0
	for i in range(97, 123):
		aa = max(aa, fn(chr(i)))
	print(aa)


(n, k) = [int(x) for x in input().split()]
s = input()
dic = {}
counter = 1
for item in s:
	if item not in dic:
		dic[item] = 0
s = s + '1'
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		counter += 1
	else:
		dic[s[i - 1]] += counter // k
		counter = 1
tot = 0
for item in dic:
	if dic[item] > tot:
		tot = dic[item]
print(tot)


import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 5)

def li():
	return map(int, stdin.readline().split())

def li_():
	return map(lambda x: int(x) - 1, stdin.readline().split())

def lf():
	return map(float, stdin.readline().split())

def ls():
	return stdin.readline().split()

def ns():
	return stdin.readline().rstrip()

def lc():
	return list(ns())

def ni():
	return int(stdin.readline())

def nf():
	return float(stdin.readline())
from collections import defaultdict
(n, k) = li()
s = ns()

def run_length(s: str):
	ret = []
	buf = ''
	cnt = 0
	for si in s:
		if si != buf:
			if cnt > 0:
				ret.append([buf, cnt])
			buf = si
			cnt = 1
		else:
			cnt += 1
	ret.append([buf, cnt])
	return ret
ret = run_length(s)
dic = defaultdict(int)
for (char, length) in ret:
	dic[char] += length // k
ans = 0
for (key, value) in dic.items():
	ans = max(ans, value)
print(ans)


arr = [int(x) for x in input().split()]
n = arr[0]
k = arr[1]
s = input()
smap = [0] * 26
i = 0
while i < n:
	keep = True
	if i + k - 1 < n:
		for j in range(i, i + k - 1):
			if s[j] != s[j + 1]:
				keep = False
				i = j + 1
				break
		if keep:
			smap[ord(s[i]) - 97] += 1
			i += k
	else:
		break
print(max(smap))


(n, k) = map(int, input().split())
d = {'': 0}
li = ''
ll = 0
for c in input():
	if li == c:
		ll += 1
	else:
		li = c
		ll = 1
	if ll == k:
		if li in d:
			d[li] += 1
		else:
			d[li] = 1
		li = ''
print(max(d.values()))


from itertools import *
k = int(input().split()[1])
d = {}
for (c, g) in groupby(input()):
	d[c] = d.get(c, 0) + len(list(g)) // k
print(max(d.values()))


s = input().split()
n = int(s[0])
k = int(s[1])
s = input()
t = [0] * 26
i = 0
while i <= n - k:
	test = False
	c = s[i]
	for j in range(1, k):
		if c != s[i + j]:
			i += j
			test = True
			break
	if not test:
		t[ord(c) - ord('a')] += 1
		i += k
print(max(t))


def main():
	(n, k) = list(map(int, input().split()))
	s = input()
	cnt = [0] * 26
	idx = 0
	while idx < n:
		cur = idx
		while cur < n - 1 and s[cur + 1] == s[idx] and (cur - idx + 1 < k):
			cur += 1
		if cur - idx + 1 == k:
			cnt[ord(s[idx]) - ord('a')] += 1
		idx = cur + 1
	print(max(cnt))

def __starting_point():
	main()
__starting_point()


(n, k) = list(map(int, input().split()))
l = list(input())
ans = [0] * 26
cur = [0] * 26
for i in range(n):
	if i > 0 and l[i] != l[i - 1]:
		cur[ord(l[i - 1]) - 97] = 0
	cur[ord(l[i]) - 97] += 1
	if cur[ord(l[i]) - 97] == k:
		ans[ord(l[i]) - 97] += 1
		cur[ord(l[i]) - 97] = 0
print(max(ans))


(n, k) = map(int, input().split())
s = input()
d = {}
c = 1
for i in range(26):
	d[chr(97 + i)] = 0
if k != 1:
	i = 1
	while i < n:
		if s[i - 1] == s[i]:
			c += 1
		else:
			c = 1
		if c == k:
			d[s[i]] += 1
			c = 1
			i += 1
		i += 1
	m = 0
	for i in range(26):
		if d[chr(97 + i)] > m:
			m = d[chr(97 + i)]
	print(m)
else:
	m = 0
	for i in set(s):
		if s.count(i) > m:
			m = s.count(i)
	print(m)


(n, k) = map(int, input().split())
s = input()
d = dict()
flag = False
c = 0
if k == 1:
	m = 0
	for i in range(97, 123):
		m = max(m, s.count(chr(i)))
	print(m)
	exit()
for i in range(n - 1):
	if k == c:
		c = 0
		continue
	if s[i] == s[i + 1]:
		if c == 0:
			c = 2
		else:
			c += 1
	else:
		c = 0
	if k == c:
		flag = True
		d[s[i]] = d.get(s[i], 0)
		d[s[i]] += 1
		i += 1
if flag:
	print(max(d.values()))
else:
	print('0')


(n, k) = map(int, input().split())
s = input()
a = []
t = []
counter = 0
m = n
for i in range(n):
	if i == 0:
		counter = 1
		a.append(s[i])
		continue
	if s[i] != s[i - 1]:
		t.append(counter)
		a.append(s[i])
		m -= counter
		counter = 1
	else:
		counter += 1
t.append(m)
n = len(a)
lvl = [0 for _ in range(26)]
for i in range(n):
	if t[i] >= k:
		lvl[ord(a[i]) - ord('a')] += t[i] // k
print(max(lvl))


(n, k) = map(int, input().split())
s = input()
pre = None
ans = -1000000000000000000000
f = [0] * 26
x = 0
for i in range(len(s)):
	if i == 0:
		pre = s[i]
		x += 1
	elif pre == s[i]:
		x += 1
	else:
		f[ord(pre) - ord('a')] += x // k
		x = 1
		pre = s[i]
f[ord(pre) - ord('a')] += x // k
print(max(f))


(n, k) = map(int, input().split())
s = input()
(d, a) = ({}, 1)
for (i, x) in enumerate(s):
	if i > 0:
		y = s[i - 1]
		if x == y:
			a += 1
		else:
			if d.get(y) == None:
				d[y] = []
			d[y].append(a)
			a = 1
if d.get(x) == None:
	d[x] = []
d[x].append(a)
result = 0
for (i, x) in enumerate(d):
	res = 0
	for (j, y) in enumerate(d[x]):
		res += y // k
	result = max(res, result)
print(result)


(n, k) = map(int, input().split())
string = input()
ans = {}
i = 0
while i < n:
	ch = string[i]
	j = i + 1
	count = 1
	while j < n and ch == string[j]:
		count += 1
		j += 1
	try:
		ans[ch] += count // k
	except KeyError:
		ans[ch] = count // k
	i = j
max = 0
for key in list(ans.keys()):
	if max < ans[key]:
		max = ans[key]
print(max)


def check(s, i, k):
	for j in range(i + 1, i + k):
		if s[j] != s[i]:
			return j
	return None
(n, k) = map(int, input().split())
s = input()
i = 0
l = [0] * 26
while i < n - k + 1:
	if check(s, i, k) == None:
		l[ord(s[i]) - 97] += 1
		i += k
	else:
		i = check(s, i, k)
if len(l) != 0:
	print(max(l))
else:
	print(0)


(n, k) = map(int, input().split())
s = input()
d = {}
i = 0
m = 0
while i < len(s):
	flag = False
	x = s[i:k + i]
	if len(x) != k:
		break
	for z in range(len(x)):
		if x[z] != x[-1]:
			i += z
			flag = True
			break
	if not flag:
		if x[-1] in d:
			d[x[-1]] += 1
		else:
			d[x[-1]] = 1
		i += k - 1
	i += 1
for i in d:
	if d[i[-1]] > m:
		m = d[i[-1]]
print(m)


import bisect

def level(xs, k):
	level = 0
	index = 0
	while index < len(xs):
		level += 1
		index = bisect.bisect_left(xs, xs[index] + k, index)
	return level

def all_same(string):
	for i in range(1, len(string)):
		if string[i] != string[i - 1]:
			return False
	return True

def solve(string, k):
	if len(string) < k:
		return 0
	data = {}
	freq = {}
	for c in string[:k]:
		freq[c] = freq.get(c, 0) + 1
	index = 0
	while index <= len(string) - k:
		if index > 0:
			freq[string[index - 1]] -= 1
			freq[string[index + k - 1]] = freq.get(string[index + k - 1], 0) + 1
		if freq[string[index]] == k:
			if string[index] not in data:
				data[string[index]] = []
			data[string[index]].append(index)
		index += 1
	max_level = 0
	for (char, xs) in data.items():
		candidate = level(xs, k)
		if candidate > max_level:
			max_level = candidate
	return max_level
(n, k) = map(int, input().split())
string = input()[:n]
print(solve(string, k))


from itertools import groupby
from collections import defaultdict
import sys
n = input().split()
(n, k) = (int(n[0]), int(n[1]))
d = defaultdict(int)
s = input()
for (key, g) in groupby(s):
	l = len(list(g))
	if l >= k:
		d[key] += l // k
try:
	print(max(d.values()))
except ValueError:
	print(0)


(n, k) = map(int, input().split())
s = input() + '#'
d = {}
cnt = 1
for i in range(1, n + 1):
	if s[i] == s[i - 1]:
		cnt += 1
	else:
		if s[i - 1] in d:
			d[s[i - 1]].append(cnt)
		else:
			d[s[i - 1]] = [cnt]
		cnt = 1
print(max([sum([x // k for x in t]) for t in d.values()]))


(n, k) = map(int, input().split())
s = input()
if k == 1:
	t = []
	s = list(s)
	w = list(set(list(s)))
	for i in w:
		t += [s.count(i)]
	print(max(t))
	exit(0)
if n == k:
	s = list(s)
	if s.count(s[0]) == n:
		print(1)
	else:
		print(0)
	exit(0)
d = {0: 0}
p = 1
i = 0
while i < n - 1:
	if s[i] == s[i + 1]:
		p += 1
	else:
		p = 1
	if p == k:
		if s[i] not in d:
			d[s[i]] = 1
		else:
			d[s[i]] += 1
		p = 1
		i += 2
	else:
		i += 1
print(max(d.values()))


import re
import string
(_, k) = input().split(' ')
k = int(k)
s = input()
ans = 0
for ch in string.ascii_lowercase:
	ans = max(ans, sum([len(_) // k for _ in re.split('[^' + ch + ']+', s)]))
print(ans)


nk = [int(x) for x in input().split()]
li = [0] * 513
sen = input()
i = 1
count = 1
flag = 0
if nk[0] == 1:
	print(1, end='')
elif nk[1] == 1:
	for j in sen:
		li[ord(j)] += 1
	print(max(li), end='')
else:
	temp = sen[0]
	while i < nk[0]:
		if flag == 2:
			temp = sen[i]
			count = 0
			flag = 0
		if sen[i] == temp:
			count += 1
			if nk[1] == count:
				li[ord(temp)] += 1
				flag = 2
		else:
			temp = sen[i]
			count = 1
		i += 1
	print(max(li), end='')


(n, k) = map(int, input().split())
s = list(input())
x = 0
for i in range(26):
	c = chr(i + 97)
	cl = 0
	cx = 0
	for j in range(n):
		if s[j] == c:
			cl += 1
		if cl == k:
			cx += 1
			cl = 0
		if s[j] != c:
			cl = 0
	x = max(x, cx)
print(x)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
s = input()
a = set(s)
m = 0
if n == 200000 and k == 100000:
	print(0)
else:
	for i in a:
		r = s.count(i * k)
		m = max(m, r)
	print(m)


from collections import defaultdict
d = defaultdict(list)
(n, k) = map(int, input().split())
s = input()
f = s[0]
c = 0
for i in s:
	if i == f:
		c += 1
	else:
		if c >= k:
			if f not in d:
				d[f] = [c]
			else:
				d[f].append(c)
		c = 1
		f = i
if c >= k:
	if f not in d:
		d[f] = [c]
	else:
		d[f].append(c)
ans = 0
for i in d:
	b = 0
	for x in d[i]:
		b += x // k
	ans = max(ans, b)
print(ans)


(l, k) = map(int, input().split())
s = input()
c = [None] * 26
for i in range(26):
	c[i] = []
a = 1
for i in range(1, l):
	if s[i] != s[i - 1]:
		c[ord(s[i - 1]) - ord('a')].append(a)
		a = 1
	else:
		a += 1
c[ord(s[l - 1]) - ord('a')].append(a)
ans = 0
for i in range(26):
	cumm = 0
	for j in c[i]:
		cumm += j // k
	ans = max(ans, cumm)
print(ans)


(n, k) = map(int, input().split())
s = input()
x = {}
for i in 'abcdefghijklmnopqrstuvwxyz':
	x[i] = 0
count = 1
if count == k:
	x[s[0]] += 1
	count = 0
for i in range(n - 1):
	if s[i + 1] == s[i]:
		count += 1
	else:
		count = 1
	if count == k:
		x[s[i + 1]] += 1
		count = 0
print(max(x.values()))


import sys
(n, k) = map(int, input().split())
s = input().strip()
last = ''
count = 0
ans = {}
for c in s:
	if c != last:
		if last not in ans.keys():
			ans[last] = 0
		ans[last] += count // k
		last = c
		count = 1
	else:
		count += 1
if last not in ans.keys():
	ans[last] = 0
ans[last] += count // k
count = 1
print(max(ans.values()))


(n, m) = map(int, input().split())
a = input()
array = [0] * 200
i = 0
while i <= n - m:
	p = a[i]
	q = 0
	for j in range(1, m):
		if p != a[i + j]:
			i += j
			q = 1
			break
	if q == 0:
		array[ord(p)] += 1
		i += m
print(max(array))


(n, k) = map(int, input().split())
s = input() + '#'
l = [0] * 26
cnt = 1
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		cnt += 1
	else:
		l[ord(s[i - 1]) - ord('a')] += cnt // k
		cnt = 1
print(max(l))


R = lambda : map(int, input().split())
(n, k) = R()
s = [ord(i) - ord('a') for i in input()]
f = [0] * 26
i = 0
pre = s[i]
c = 0
while i < n:
	if s[i] == pre:
		c += 1
	else:
		c = 1
		pre = s[i]
	if c == k:
		f[pre] += 1
		c = 0
	i += 1
print(max(f))


(n, k) = map(int, input().split())
s = input()
c = 'abcdefghijklmnopqrstuvwxyz'
ans = 0
for ch in c:
	lvl = 0
	count = 0
	for i in s:
		if i == ch:
			count += 1
			if count == k:
				count = 0
				lvl += 1
		else:
			count = 0
	if lvl > ans:
		ans = lvl
print(ans)


import itertools
from collections import defaultdict, Counter
(n, k) = [int(v) for v in input().split()]
s = input().strip()
d = defaultdict(Counter)
for (c, ss) in itertools.groupby(s):
	l = len(list(ss))
	d[c][l] += 1

def selectable(x, cnt):
	for (l, num) in cnt.items():
		x -= l // k * num
		if x <= 0:
			return True
	return False
(lo, hi) = (0, n // k + 1)
while lo < hi:
	x = (lo + hi) // 2
	if any((selectable(x, cnt) for cnt in d.values())):
		lo = x + 1
	else:
		hi = x
print(lo - 1)


(n, k) = map(int, input().split())
s = input() + '.'
a = [1 for i in range(n)]
d = {}
for i in range(1, n):
	if s[i] == s[i - 1]:
		a[i] = a[i - 1] + 1
for i in range(n):
	if s[i] != s[i + 1]:
		if s[i] in d:
			if a[i] in d[s[i]]:
				d[s[i]][a[i]] += 1
			else:
				d[s[i]][a[i]] = 1
		else:
			d[s[i]] = {}
			d[s[i]][a[i]] = 1
ans = 0
for c in d:
	tmpa = 0
	for size in d[c]:
		if size >= k:
			tmpa += size // k * d[c][size]
	ans = max(ans, tmpa)
print(ans)


from collections import defaultdict
(n, k) = list(map(int, input().split()))
a = defaultdict(int)
p = '@'
x = 0
for el in input():
	if el == p:
		x += 1
	elif p != '@':
		a[p] += (x + 1) // k
		x = 0
	p = el
if k != 0:
	a[p] += (x + 1) // k
print(max(a.values()))


import sys
input = sys.stdin.readline
(n, k) = list(map(int, input().strip().split()))
s = input().strip()
if n == 200000 and k == 100000:
	print(0)
else:
	print(max([s.count(c * k) for c in set(s)]))


(n, k) = [int(s) for s in input().split()]
s = input()
counter = 1
dict = {'fictive': 0}
if n == 1 and k == 1:
	print(1)
else:
	if k == 1:
		for i in range(len(s)):
			dict[s[i]] = dict.get(s[i], 0) + 1
	else:
		i = 1
		while i < len(s):
			if s[i] == s[i - 1]:
				counter += 1
			else:
				counter = 1
			if counter == k:
				dict[s[i] * k] = dict.get(s[i] * k, 0) + 1
				counter = 1
				i += 1
			i += 1
	print(max(dict.values()))


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return len(set(factors))

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def printp(p):
	for i in p:
		print(i)
MOD = 10 ** 9 + 7
T = 1
for _ in range(T):
	(n, k) = list(map(int, stdin.readline().split()))
	a = list(stdin.readline().strip('\n'))
	d = {}
	ix = []
	for i in range(n - 1):
		if a[i] != a[i + 1]:
			ix.append(i)
	if len(ix) == 0:
		print(n // k)
		continue
	d[a[0]] = 0
	d[a[-1]] = 0
	d[a[0]] += (ix[0] + 1) // k
	d[a[-1]] += (n - 1 - ix[-1]) // k
	for i in range(1, len(ix)):
		if a[ix[i]] not in d:
			d[a[ix[i]]] = (ix[i] - ix[i - 1]) // k
		else:
			d[a[ix[i]]] += (ix[i] - ix[i - 1]) // k
	print(max(d.values()))


(n, k) = map(int, input().split())
s = input()
prev = ''
ssum = {}
cnt = 0
for i in range(n):
	moji = s[i]
	if moji == prev:
		cnt += 1
	else:
		cnt = 1
	if cnt == k:
		if moji in ssum:
			ssum[moji] += 1
		else:
			ssum[moji] = 1
		cnt = 0
	prev = moji
if len(ssum) == 0:
	print('0')
else:
	mmax = max(ssum.values())
	print(mmax)


(n, k) = map(int, input().split())
s = input()
freq = [0] * 26
i = 0
while i < n:
	p = 1
	while i < n - 1 and s[i] == s[i + 1]:
		p += 1
		i += 1
	freq[ord(s[i]) - 97] += p // k
	i += 1
print(max(freq))


(n, k) = map(int, input().split())
s = input()
if n == 1:
	print('1')
	exit(0)
max_len_substr = []
one_str = s[0]
c = s[0]
for i in range(1, n):
	if c == s[i]:
		one_str += s[i]
	else:
		max_len_substr.append(str(one_str))
		one_str = s[i]
	c = s[i]
max_len_substr.append(str(one_str))
reduced_lst = []
for elem in max_len_substr:
	if len(elem) >= k:
		reduced_lst.append(elem)
final_lst = []
reduced_lst.sort()
if len(reduced_lst) == 0:
	print('0')
	exit(0)
tot = []
word = reduced_lst[0]
count = int(len(word) / k)
for i in range(1, len(reduced_lst)):
	l = len(reduced_lst[i])
	nom = int(l / k)
	if word[0] == reduced_lst[i][0]:
		count += nom
	else:
		tot.append(count)
		count = nom
		word = reduced_lst[i][0]
tot.append(count)
print(max(tot))


from collections import Counter
(n, k) = map(int, input().split())
l = list(input())
i = 0
r = [0] * 27
c = 1
l1 = list(Counter(l).values())
if k == 1:
	print(max(l1))
	exit()
while i < n - 1:
	if l[i] == l[i + 1]:
		c += 1
	else:
		c = 1
	if c == k:
		r[ord(l[i]) - 97] += 1
		i += 1
		c = 1
	i += 1
print(max(r))


from sys import stdin

def kmp(pat, txt):
	leng = 0
	i = 1
	ans = 0
	M = len(pat)
	N = len(txt)
	lps = [0] * M
	j = 0
	while i < M:
		if pat[i] == pat[leng]:
			leng += 1
			lps[i] = leng
			i += 1
		elif leng != 0:
			leng = lps[leng - 1]
		else:
			lps[i] = 0
			i += 1
	i = 0
	while i < N:
		if pat[j] == txt[i]:
			i += 1
			j += 1
		if j == M:
			ans += 1
			i = i - j + len(pat)
			j = 0
		elif i < N and pat[j] != txt[i]:
			if j != 0:
				j = lps[j - 1]
			else:
				i += 1
	return ans
from sys import stdin
(n, m) = map(int, stdin.readline().strip().split())
s = stdin.readline().strip()
ans = 0
for i in range(26):
	ans = max(ans, kmp(chr(97 + i) * m, s))
print(ans)


from collections import defaultdict
(n, k) = map(int, input().split())
s = input()
pre = s[0]
tmp = 1
dic = defaultdict(list)
for i in range(1, n):
	if pre != s[i]:
		dic[pre].append(tmp)
		tmp = 1
		pre = s[i]
	else:
		tmp += 1
		pre = s[i]
dic[s[-1]].append(tmp)
num = 0
for i in range(26):
	tmp = 0
	for j in dic[chr(i + ord('a'))]:
		tmp += j // k
	num = max(num, tmp)
print(num)


(i, k) = map(int, input().split())
l = list(input())
m = {}
for x in 'abcdefghijklmnopqrstuvwxyz':
	m[x] = 0
c = l[0]
t = 1
if t == k:
	t = 0
	m[c] += 1
for x in range(1, i):
	if l[x] == c:
		t += 1
	else:
		c = l[x]
		t = 1
	if t == k:
		t = 0
		m[c] += 1
print(m[max(m, key=m.get)])


from collections import defaultdict
(n, k) = map(int, input().split())
s = input()
symbs = set(s)
rr = defaultdict(list)
prev = s[0]
for i in s[1:]:
	if len(prev) == k:
		rr[prev[0]].append(prev)
		prev = i
		continue
	if prev[0] == i:
		prev += i
		continue
	if len(prev) < k:
		prev = i
		continue
	rr[prev[0]].append(prev)
	prev = i
rr[prev[0]].append(prev)
max_ = 0
for (key, v) in rr.items():
	level = sum((1 if len(i) == k else 0 for i in v))
	if level > max_:
		max_ = level
print(max_)


from itertools import *
k = int(input().split()[1])
d = {}
for (c, g) in groupby(input()):
	d[c] = d.get(c, 0) + sum(map(lambda _: 1, g)) // k
print(max(d.values()))


(n, k) = map(int, input().split())
a = list(input())
ans = {}
for i in range(97, 123):
	ans[chr(i)] = 0
pr = a[0]
summ = 0
for i in range(n):
	if a[i] == pr:
		summ += 1
	else:
		ans[pr] += summ // k
		pr = a[i]
		summ = 1
ans[pr] += summ // k
print(max(ans.values()))


import math as ma
import sys
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())
mm = 1000000007
t = 1
for it in range(t):
	(n, k) = num()
	s = input()
	z = [''] * 26
	for i in range(26):
		z[i] = []
	pq = s[0]
	for i in range(1, n):
		if s[i] == pq[0]:
			pq += s[i]
		else:
			z[ord(pq[0]) - 97].append(pq)
			pq = s[i]
	z[ord(pq[0]) - 97].append(pq)
	mx = 0
	for i in range(26):
		if len(z[i]) == 0:
			continue
		s = 0
		for j in range(len(z[i])):
			s += len(z[i][j]) // k
		mx = max(s, mx)
	print(mx)


(n, k) = map(int, input().split())
a = input()
d = list(set(a))
max_ = 0
t = 0
if n == 200000 and k == 100000:
	print(0)
	exit()
for i in range(len(d)):
	t = a.count(d[i] * k)
	max_ = max(max_, t)
	t = 0
print(max_)


(n, k) = list(map(int, input().strip().split()))
s = input()
from collections import Counter
same = [1] * n
maxi = dict()
ans = 0
if k == 1:
	c = Counter(s)
	ans = c.most_common(1)[0][1]
else:
	for x in range(1, n):
		if s[x - 1] == s[x]:
			same[x] = same[x - 1] + 1
		elif s[x - 1] in maxi:
			maxi[s[x - 1]] += same[x - 1] // k
		else:
			maxi[s[x - 1]] = same[x - 1] // k
	if s[n - 1] == s[n - 2]:
		if s[n - 1] in maxi:
			maxi[s[n - 1]] += same[n - 1] // k
		else:
			maxi[s[n - 1]] = same[n - 1] // k
	v = [i[1] for i in maxi.items()]
	ans = max(v)
print(ans)


class CodeforcesTask1105BSolution:

	def __init__(self):
		self.result = ''
		self.n_k = []
		self.string = ''

	def read_input(self):
		self.n_k = [int(x) for x in input().split(' ')]
		self.string = input()

	def process_task(self):
		scores = [0] * 26
		prev = None
		prog = 0
		for x in range(self.n_k[0]):
			c = self.string[x]
			if prev == c:
				prog += 1
			else:
				prog = 1
			if prog == self.n_k[1]:
				scores[ord(c) - 97] += 1
				prog = 0
			prev = c
		self.result = str(max(scores))

	def get_result(self):
		return self.result
Solution = CodeforcesTask1105BSolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


input1 = input().split(' ')
string = list(input())
n = int(input1[0])
k = int(input1[1])
table = []
index = []
maximum = 0
for i in range(26):
	table.append([])
	index.append(0)
table[ord(string[0]) - 97].append(1)
for i in range(1, len(string)):
	if string[i] == string[i - 1]:
		table[ord(string[i]) - 97][index[ord(string[i]) - 97]] += 1
	else:
		index[ord(string[i - 1]) - 97] += 1
		table[ord(string[i]) - 97].append(1)
for i in range(26):
	cnt = 0
	for j in table[i]:
		cnt += j // k
	if cnt > maximum:
		maximum = cnt
print(maximum)


n = input().split()
k = int(n[1])
l = int(n[0])
seq = input()
i = 0
dic = dict()
while i < l:
	j = 1
	while i < l - 1 and seq[i] is seq[i + 1] and (j < k):
		j += 1
		i += 1
	if j == k:
		dic[seq[i]] = dic.get(seq[i], 0) + 1
	i += 1
max = 0
for (char, count) in list(dic.items()):
	if max is None or count > max:
		max = count
print(max)


(n, k) = map(int, input().split())
counts = [0] * 26
s = input()
i = 0
j = k
d = dict()
for i in range(n):
	if s[i] in d:
		d[s[i]].append(i)
	else:
		d[s[i]] = [i]
ss = []
for i in d.values():
	li = len(i)
	j = 0
	ff = 0
	while j < n:
		if j + k - 1 < li:
			if i[j + k - 1] - i[j] == k - 1:
				ff += 1
				j += k
			else:
				j += 1
		else:
			break
	ss.append(ff)
print(max(ss))


from sys import stdin, stdout
from collections import Counter

def ai():
	return list(map(int, stdin.readline().split()))

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
from math import ceil
(n, k) = ei()
s = input()
d = {}
(i, j) = (0, 0)
ans = 0
while i < n:
	j = i
	while j < n and s[j] == s[i]:
		j += 1
	ans = (j - i) // k
	if s[i] in d:
		d[s[i]] += ans
	else:
		d[s[i]] = ans
	i = j
print(max(d.values()))


(n, k) = map(int, input().split())
s = input()
s2 = ''
s1 = dict()
count = 0
for i in range(n):
	if count == k:
		if s2 not in s1:
			s1[s2] = 1
		else:
			s1[s2] += 1
		s2 = s[i]
		count = 1
	elif count < k and count != 0 and (s[i] == s2[-1]):
		s2 += s[i]
		count += 1
	else:
		s2 = s[i]
		count = 1
if count == k:
	if s2 not in s1:
		s1[s2] = 1
	else:
		s1[s2] += 1
maxx = 0
for i in s1:
	if s1[i] > maxx:
		maxx = s1[i]
print(maxx)


(n, k) = map(int, input().split())
s = input()
d = [0]
b = list(s)
c = list(set(b))
if len(c) == 1:
	print(n // k)
	exit()
max_cnt = 0
st = 'abcdefghijklmnopqrstuvwxyz'
a = 0
level = -1
for l in st:
	cnt = 0
	m = 0
	for i in s:
		if i == l:
			m += 1
			if m % k == 0:
				cnt += 1
				m = 0
		else:
			m = 0
	level = max(level, cnt)
print(level)


k = int(input().split()[1])
result = {}
prev = 0
value = 0
STR = input() + '$'
for letter in STR:
	if letter != prev:
		result[prev] = result.get(prev, 0) + value // k
		prev = letter
		value = 0
	value += 1
print(max(result.values()))


from sys import stdin
from collections import defaultdict
(n, k) = map(int, input().split())
string = stdin.readline().strip()
found = set()
cnt = defaultdict(int)
i = 0
while i <= n - k:
	if string[i:i + k] == string[i] * k:
		cnt[string[i]] += 1
		i += k
	else:
		while string[i] == string[i + 1]:
			i += 1
		i += 1
if not cnt.values():
	print(0)
else:
	print(max(cnt.values()))


from collections import defaultdict as dd, deque
D = dd(list)
(n, k) = map(int, input().split())
s = input() + '$'
last = None
l = 0
for c in s:
	if last != c:
		if l > 0:
			D[last].append(l)
			l = 0
	last = c
	l += 1
print(max((sum((x // k for x in D[d])) for d in D)))


from collections import Counter
(l, k) = [int(x) for x in input().split()]
s = input()
(i, d) = (0, Counter())
while i < l:
	j = i
	while j < l and s[j] == s[i]:
		j += 1
	d[s[i]] += (j - i) // k
	i = j
print(max(d.values()))


(n, k) = map(int, input().split())
s = input()
prev = s[0]
d = {}
count = 1
for i in range(1, n):
	if s[i] == prev:
		count += 1
	else:
		if not d.get(prev):
			d[prev] = [count]
		else:
			d[prev].append(count)
		count = 1
		prev = s[i]
if not d.get(prev):
	d[prev] = [count]
else:
	d[prev].append(count)
	count = 1
	prev = s[i]
result = 0
for key in d.keys():
	count = 0
	for x in d[key]:
		count += x // k
	result = max(result, count)
print(result)


(n, k) = [int(i) for i in input().split()]
dic = dict()
s = list(input())
i = 0
while i < n:
	j = 1
	while i + j < n and s[i] == s[i + j]:
		j += 1
	if s[i] not in dic:
		dic[s[i]] = []
	dic[s[i]].append(j)
	i += j
ans = 0
for i in list(dic.keys()):
	ct = 0
	for j in dic[i]:
		ct += j // k
	ans = max(ans, ct)
print(ans)


from collections import defaultdict
import itertools
(n, k) = map(int, input().split())
s = input()
d = defaultdict(int)
for (c, g) in itertools.groupby(s):
	d[c] += len(list(g)) // k
print(max(d.values()))


(n, k) = map(int, input().split())
seq = input()
letras = {}
i = 0
while i < n:
	qnt = 1
	while i + 1 < n and seq[i] == seq[i + 1]:
		i += 1
		qnt += 1
	if seq[i] in letras:
		letras[seq[i]] += qnt // k
	else:
		letras[seq[i]] = qnt // k
	i += 1
q = list(letras.values())
print(max(q))


nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
dct = {}
s = input() + '0'
for i in s:
	dct[i] = 0
x = 0
klook = 1
for i in s[1:]:
	if i == s[x]:
		klook += 1
	else:
		dct[s[x]] += klook // k
		klook = 1
	x += 1
print(max(dct.values()))


(n, k) = map(int, input().split())
a = list(input())
ans = [0 for i in range(26)]
i = 0
while i < n - k + 1:
	c = a[i]
	for j in range(i, i + k):
		if a[j] != a[i]:
			i = j
			break
	else:
		ans[ord(a[i]) - 97] += 1
		i += k
print(max(ans))


(n, k) = map(int, input().split())
s = input()
d = {'aa': 0}
(i, j) = (0, 0)
while i < n:
	j = i + 1
	c = 1
	while j < n and j < i + k and (s[j] == s[j - 1]):
		c += 1
		j += 1
	if c == k:
		if s[j - 1] not in d:
			d[s[j - 1]] = 1
		else:
			d[s[j - 1]] += 1
	i = j
print(max(d.values()))


(_, n) = map(int, input().split(' '))
word = input()
d = {}
ultimo = 0
count = 0
for letra in word + ' ':
	if letra != ultimo:
		d[ultimo] = d.get(ultimo, 0) + count // n
		count = 0
		ultimo = letra
	count += 1
print(max(d.values()))


(n, k) = list(map(int, input().split()))
s = input()
sm = 0
dic = {}
if k == 1:
	mx = 0
	e = []
	for x in set(s):
		if s.count(x) > mx:
			mx = s.count(x)
	print(mx)
	exit()
for i in range(n - 1):
	if s[i] == s[i + 1]:
		sm += 1
		if sm >= k:
			if s[i] in dic.keys():
				dic[s[i]] += 1
			else:
				dic.update({s[i]: 1})
			sm = 0
	else:
		sm += 1
		if sm >= k:
			if s[i] in dic.keys():
				dic[s[i]] += 1
			else:
				dic.update({s[i]: 1})
		sm = 0
if sm != 0:
	sm += 1
	if sm >= k:
		if s[i] in dic.keys():
			dic[s[i]] += 1
		else:
			dic.update({s[i]: 1})
mx = 0
for x in dic.keys():
	if dic[x] > mx:
		mx = dic[x]
print(mx)


(n, k) = map(int, input().split())
s = input()
m = (-1, 0)
t = {}
co = 0
pre = -1
for i in s:
	if m[0] != i:
		m = (i, 1)
	else:
		m = (i, m[1] + 1)
	if m[1] == k:
		m = (-1, 0)
		if i not in t:
			t[i] = 1
		else:
			t[i] += 1
ma = 0
for i in t:
	ma = max(ma, t[i])
print(ma)


def solve(n, k, string):
	non = set(string)
	level = 0
	for x in non:
		same = 0
		temp = 0
		for y in string:
			if same == k:
				temp += 1
				same = 0
			if y == x:
				same += 1
			else:
				same = 0
		if same == k:
			temp += 1
		if temp > level:
			level = temp
	return level
(n, k) = list(map(int, input().split()))
print(solve(n, k, input()))


(n, k) = map(int, input().split())
str = input()
di = {}
streak = 0
char = str[0]
di[str[0]] = []
for x in str:
	if x == char and streak < k:
		streak += 1
	else:
		di[char].append(streak)
		streak = 1
		char = x
		if x not in di:
			di[x] = []
if x in di:
	di[x].append(streak)
else:
	di[x] = [streak]
substrings = []
for x in di:
	ans = 0
	for y in di[x]:
		if y >= k:
			ans += 1
	substrings.append(ans)
print(max(substrings))


from collections import defaultdict
(n, k) = map(int, input().split())
s = input()
d = defaultdict(lambda : 0)
i = 1
curr = 1
if k == 1:
	for i in s:
		d[i] += 1
else:
	while i < n:
		if s[i] == s[i - 1]:
			curr += 1
		else:
			curr = 1
		if curr == k:
			d[s[i]] += 1
			curr = 1
			try:
				if s[i] == s[i + 1]:
					curr = 0
			except:
				pass
		i += 1
mx = 0
for i in d:
	mx = max(mx, d[i])
print(mx)


(n, k) = map(int, input().split())
s = input()
d = {}
for i in range(ord('a'), ord('z') + 1):
	d[chr(i)] = 0
cur_c = 'a'
cur_l = 0
for c in s:
	if cur_c == c:
		cur_l += 1
	else:
		d[cur_c] += cur_l // k
		cur_l = 1
		cur_c = c
d[cur_c] += cur_l // k
m = 0
for k in d:
	m = max(m, d[k])
print(m)


from collections import defaultdict
(n, k) = [int(i) for i in input().split()]
s = input()
substrings = defaultdict(list)
current_letter = ''
current_len = 0
for i in s:
	if current_letter != i:
		if current_letter:
			substrings[current_letter].append(current_len)
		current_letter = i
		current_len = 1
	else:
		current_len += 1
substrings[current_letter].append(current_len)
max_x = 0
for (key, value) in substrings.items():
	x = sum((l // k for l in value))
	if x > max_x:
		max_x = x
print(max_x)


(n, k) = input().split()
n = int(n)
k = int(k)
s = input()
arr = []
f = s[0]
z = ''
for i in range(len(s)):
	if s[i] == f:
		z = z + s[i]
	else:
		f = s[i]
		arr.append(z)
		z = f
arr.append(z)
arr
arr.sort()
f = arr[0][0]
c = 0
i = 0
q = []
while i < len(arr):
	if f in arr[i]:
		c = c + int(len(arr[i]) / k)
	else:
		q.append(c)
		c = 0
		f = arr[i][0]
		i = i - 1
		pass
	i = i + 1
q.append(c)
print(max(q))


(n, k) = map(int, input().strip().split())
s = input().strip() + ' '
prev_sym = s[0]
prev_idx = -1
sym_set = []
slen = len(s)
for (idx, sym) in enumerate(s[1:slen]):
	if not prev_sym == sym:
		sym_set.append((idx - prev_idx, prev_sym))
		prev_sym = sym
		prev_idx = idx
sym_set = list(filter(lambda x: x[0] >= k, sorted(sym_set)))
for (i, v) in enumerate(sym_set):
	el_num = v[0] // k
	if el_num > 1:
		sym_set[i] = (k, v[1])
		el_num -= 1
		sym_set += [[k, v[1]] for j in range(el_num)]
sym_map = {}
for i in sym_set:
	if sym_map.get(i[1]) == None:
		sym_map[i[1]] = 0
	sym_map[i[1]] += 1
max_num = 0
for i in sym_map:
	if sym_map[i] >= max_num:
		max_num = sym_map[i]
print(max_num)


def main():
	(n, k) = map(int, input().split())
	s = input()
	letters = {}
	curr = s[0]
	count = 0
	for i in s:
		if i == curr:
			count += 1
		else:
			if curr not in letters.keys():
				letters[curr] = 0
			letters[curr] += count // k
			count = 1
			curr = i
	if curr not in letters.keys():
		letters[curr] = 0
	letters[curr] += count // k
	max_val = 0
	for i in letters.keys():
		max_val = max(max_val, letters[i])
	print(max_val)
main()


(n, k) = map(int, input().split())
lst = list(input())
lstset = list(set(lst))
if k == 1:
	max1 = 0
	for i in lstset:
		if lst.count(i) > max1:
			max1 = lst.count(i)
	print(max1)
else:
	final = []
	for i in lstset:
		count = 0
		c = []
		for j in range(len(lst) - 1):
			if lst[j] == i:
				if lst[j] == lst[j + 1]:
					count += 1
				if lst[j] == lst[j + 1] and j == len(lst) - 2:
					c.append(int((count + 1) / k))
			if lst[j] == i and lst[j] != lst[j + 1]:
				c.append(int((count + 1) / k))
				count = 0
		final.append(sum(c))
	print(max(final))


(n, k) = map(int, input().split())
s = input() + '!'
a = {}
b = s[0]
c = 1
for i in s[1:]:
	if i == b:
		c += 1
	else:
		a[b] = a.get(b, 0) + c // k
		b = i
		c = 1
print(max(a.values()))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, k) = LI()
	s = S()
	t = ''
	d = collections.defaultdict(int)
	d[''] = 0
	b = 0
	for c in s:
		if t != c:
			b = 1
			t = c
		else:
			b += 1
		if b % k == 0:
			d[t] += 1
	return max(d.values())
print(main())


from collections import Counter
from sys import stdin, stdout

def all_equal(s, start, end):
	for i in range(start, end - 1):
		if s[i] != s[i + 1]:
			return i + 1
	return -1

def main():
	(n, k) = [int(x) for x in stdin.readline().split()]
	s = stdin.readline()
	lis = []
	i = 0
	if k == 1:
		stdout.write(str(Counter(s).most_common(1)[0][1]))
		return
	while i < n:
		if i + k > n:
			break
		is_equal = all_equal(s, i, i + k)
		if is_equal == -1:
			lis.append(s[i])
			i += k
		else:
			i = is_equal
	counter = Counter(lis)
	res = 0 if len(counter) == 0 else counter.most_common(1)[0][1]
	stdout.write(str(res))
	return
main()


def f(s, c, k):
	(ans, i) = (0, 0)
	while i < len(s):
		l = 0
		while i + l < len(s) and s[i + l] == c and (l < k):
			l += 1
		if l == k:
			ans += 1
			l -= 1
		i += l + 1
	return ans
(n, k) = map(int, input().split())
s = input()
print(max((f(s, x, k) for x in set(s))))


(j, k) = input().split()
j = int(j)
k = int(k)
l = input()
x = m = 0
f = l[0]
d = {}
for i in l:
	if i != f:
		if f in d:
			d[f] += x // k
		else:
			d[f] = x // k
		f = i
		x = 0
	x += 1
if f in d:
	d[f] += x // k
else:
	d[f] = x // k
print(d[max(d.keys(), key=lambda k: d[k])])


(n, k) = map(int, input().strip().split())
s = input()
c = 0
d = {}
s += ' '
for i in range(n):
	c += 1
	if s[i] != s[i + 1]:
		if s[i] not in d:
			d[s[i]] = int(c / k)
		else:
			d[s[i]] += int(c / k)
		c = 0
ma = 0
for i in d:
	if d[i] > ma:
		ma = d[i]
print(ma)


(n, k) = map(int, input().split())
a = input()
LVL = 0
STR = list(set(a))
if n == 200000 and k == 100000:
	print(0)
else:
	for i in range(len(STR)):
		MAX = a.count(STR[i] * k)
		if LVL < MAX:
			LVL = MAX
	print(LVL)


mod = 10 ** 9 + 7
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
import itertools
(n, k) = f()
s = si()
d = dict()
mx = 0
for (c, g) in itertools.groupby(s):
	d[c] = d.get(c, 0) + sum((1 for i in g)) // k
print(max(d.values()))


(n, k) = map(int, input().split())
s = list(input())
d = {}
i = 0
while i < len(s):
	j = i
	cnt = 0
	while j < len(s) and s[j] == s[i]:
		j += 1
	cnt = (j - i) // k
	if s[i] not in d:
		d[s[i]] = cnt
	else:
		d[s[i]] += cnt
	i = j
res = max(d.values())
print(res)


import sys
import math
import itertools
import collections

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return '\n'.join(map(str, arr))

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
(n, k) = mi()
s = input()
i = 0
carr = [0] * 26
orda = ord('a')
while i < n:
	t = 1
	while i < n - 1 and s[i] == s[i + 1]:
		t += 1
		i += 1
	carr[ord(s[i]) - orda] += t // k
	i += 1
print(max(carr))


import itertools
from collections import Counter
(n, k) = [int(x) for x in input().split()]
s = input()
levels = Counter()
for (key, sequence) in itertools.groupby(s):
	sequence_str = ''.join(sequence)
	if len(sequence_str) >= k:
		levels[key] += len(sequence_str) // k
if len(levels) > 0:
	print(levels.most_common(1)[0][1])
else:
	print('0')


(n, k) = map(int, input().split())
a = input()
b = [0] * 26
for i in range(26):
	j = 0
	cnt = 0
	while j < n:
		if ord(a[j]) - 97 == i:
			cnt = 0
			while ord(a[j]) - 97 == i:
				cnt += 1
				j += 1
				if j >= n:
					break
		else:
			j += 1
			b[i] += cnt // k
			cnt = 0
	b[i] += cnt // k
print(max(b))


(a, b) = list(map(int, input().split()))
s = input()
dct = {'-': 0}
i = 0
while i < a:
	k = 0
	while i + k < a and s[i + k] == s[i]:
		k += 1
		if k == b:
			if s[i] in dct:
				dct[s[i]] += 1
			else:
				dct[s[i]] = 1
			break
	i += k
print(max(dct.values()))


(n, k) = map(int, input().split())
s = input() + '7'
d = {chr(i): 0 for i in range(97, 97 + 26)}
a = s[0]
cnt = 1
for i in range(1, n + 1):
	if s[i] == a:
		cnt += 1
	else:
		if cnt >= k:
			d[a] += cnt // k
		a = s[i]
		cnt = 1
a = 0
for i in d:
	a = max(a, d[i])
print(a)


from sys import stdin, stdout

def main():
	(n, k) = [int(i) for i in stdin.readline().split()]
	s = stdin.readline()
	alph = {}
	char = s[0]
	count = 1
	for i in range(1, n):
		if s[i] == char:
			count += 1
		else:
			alph[char] = alph.get(char, 0) + count // k
			char = s[i]
			count = 1
	alph[char] = alph.get(char, 0) + count // k
	best = 0
	for i in alph.keys():
		best = max(alph[i], best)
	stdout.write(str(best) + '\n')
main()


(n, k) = map(int, input().split())
i = 0
s = input()
cnt = {chr(ord('a') + i): 0 for i in range(26)}
m = len(s)
while i < m:
	j = i
	if i + 1 < m and s[i + 1] == s[i]:
		while i + 1 < m and s[i + 1] == s[i]:
			i += 1
	cnt[s[j]] += (i - j + 1) // k
	i += 1
print(max(cnt.values()))


(n, k) = map(int, input().split())
s = input().strip()
a = [0] * 30
ans = 0
i = 0
while i < n:
	cnt = 1
	while i < n - 1 and cnt < k and (s[i] == s[i + 1]):
		i += 1
		cnt += 1
	if cnt == k:
		a[ord(s[i]) - ord('a')] += 1
	i += 1
for i in range(26):
	if ans < a[i]:
		ans = a[i]
print(ans)


from collections import defaultdict as dc
(n, k) = [int(i) for i in input().split()]
s = str(input())
p = dc(list)
q = []
c = 1
l = 0
for i in range(n - 1):
	if s[i] == s[i + 1]:
		c = c + 1
	else:
		p[s[i]].append(c)
		c = 1
p[s[n - 1]].append(c)
for (i, j) in p.items():
	c = 0
	for m in range(len(j)):
		c = c + j[m] // k
	q.append(c)
print(max(q))


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from collections import defaultdict as dd
(n, k) = I()
s = input()
l = [0] * n
l[-1] = 1
for i in range(n - 2, -1, -1):
	if s[i] == s[i + 1]:
		l[i] = 1 + l[i + 1]
	else:
		l[i] = 1
d = dd(list)
d[s[0]].append(0)
for i in range(1, n):
	if s[i] == s[i - 1]:
		continue
	d[s[i]].append(i)
arr = [0] * 255
for i in d:
	for j in d[i]:
		arr[ord(i)] += l[j] // k
print(max(arr))


(n, k) = [int(x) for x in input().split()]
ain = input()
last = 'Z'
cnt = 0
a = [0] * 26
for x in ain:
	if x is last:
		cnt += 1
	else:
		cnt = 1
	if cnt == k:
		a[ord(x) - ord('a')] += 1
		cnt = 0
	last = x
print(max(a))


(n, k) = map(int, input().split())
s = input()
d = {}
prev = 'na'
for sym in s:
	if sym in d.keys():
		if sym == prev:
			d[sym][-1] += 1
		else:
			d[sym].append(1)
	else:
		d[sym] = [1]
	prev = sym
mx = 0
for (_, v) in d.items():
	tmp = 0
	for x in v:
		tmp += x // k
	mx = max(mx, tmp)
print(mx)


import collections
(n, k) = map(int, input().split())
a = str(input())
d = {}
c = 0
for i in range(1, n):
	if a[i - 1] == a[i]:
		c += 1
	elif a[i - 1] not in d:
		d[a[i - 1]] = [c + 1]
		c = 0
	else:
		d[a[i - 1]].append(c + 1)
		c = 0
if a[n - 1] in d:
	d[a[n - 1]].append(c + 1)
else:
	d[a[n - 1]] = [c + 1]
m = 0
for i in d:
	s = 0
	for j in d[i]:
		s += j // k
	m = max(s, m)
print(m)


import sys
import collections
from collections import Counter
import itertools
import math
import timeit

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
(n, k) = mi()
s = input()
d = dd()
i = res = 0
while i < n:
	j = i + 1
	while j < n and s[i] == s[j]:
		j += 1
	if j - i >= k:
		d[s[i]] += (j - i) // k
		res = max(res, d[s[i]])
	i = j
print(res)


def main():
	(n, k) = map(int, input().split())
	s = input()
	left = right = 0
	count_dict = {}
	while left < n and right < n:
		while right < n and right - left < k and (s[right] == s[left]):
			right += 1
		if right - left == k:
			temp = s[left:right]
			count_dict[temp] = count_dict.get(temp, 0) + 1
		left = right
	if right - left == k:
		temp = s[left:right]
		count_dict[temp] = count_dict.get(temp, 0) + 1
	ret = 0
	for (k, v) in count_dict.items():
		ret = max(ret, v)
	print(ret)
main()


from collections import Counter
k = int(input().split()[1])
s = input()
precalc = []
counter = Counter()
last_char = None
for c in s:
	if c != last_char:
		last_char = c
		precalc.append([c, 1])
	else:
		precalc[-1][1] += 1
for (c, count) in precalc:
	if count >= k:
		counter[c] += count // k
common = counter.most_common(1)
if common:
	print(common[0][1])
else:
	print(0)


import sys
import math

def read_int():
	return int(input().strip())

def read_int_list():
	return list(map(int, input().strip().split()))

def read_string():
	return input().strip()

def read_string_list(delim=' '):
	return input().strip().split(delim)
(n, k) = read_int_list()
s = read_string()
seen_distincts = {}
start = 0
while start < n - k + 1:
	temp_dist = s[start]
	broken = 0
	broken_at = -1
	for i in range(1, k):
		if s[start + i] == temp_dist:
			pass
		else:
			broken = 1
			broken_at = start + i
			break
	if broken:
		start = broken_at
	else:
		seen_distincts[temp_dist] = seen_distincts.get(temp_dist, 0) + 1
		start += k
maxi = 0
for k in seen_distincts:
	maxi = max(maxi, seen_distincts[k])
print(maxi)


(n, k) = map(int, input().split())
s = input()
chars = {}
for c in s:
	chars[c] = 1
s += '\x00'
ans = 0
for c in chars:
	nowl = 0
	a = 0
	for d in s:
		if d == c:
			nowl += 1
		elif nowl > 0:
			a += nowl // k
			nowl = 0
	ans = max(ans, a)
print(ans)


import re
import string
(n, k) = map(int, input().split())
a = input()
c = {}
u = l = 0
for x in a:
	if x != l:
		c[l] = c.get(l, 0) + u // k
		u = 0
	u += 1
	l = x
c[l] = c.get(l, 0) + u // k
print(max((c.get(x, 0) for x in string.ascii_lowercase)))


(n, k) = map(int, input().split())
array = input()

def search_idx(alphabet, letter):
	for (idx, alpha_letter) in enumerate(alphabet):
		if alpha_letter == letter:
			return idx
alphabet = 'abcdefghijklmnopqrstuvwxyz'
level_count = [0] * 26
letter_count = 0
last_letter = array[0]
for letter in array:
	if letter == last_letter:
		letter_count += 1
	else:
		letter_count = 1
	if letter_count % k == 0:
		idx = search_idx(alphabet, letter)
		level_count[idx] += 1
		letter_count = 0
	last_letter = letter
print(max(level_count))


(n, k) = list(map(int, input().split()))
s = input()
alph = 'qwertyuiopasdfghjklzxcvbnm'
ti = [0] * 26
num = 1
for i in range(1, n):
	if s[i] == s[i - 1]:
		num += 1
	else:
		if num >= k:
			ti[alph.find(s[i - 1])] += num // k
		num = 1
if num >= k:
	ti[alph.find(s[-1])] += num // k
print(max(ti))


from collections import Counter
(n, k) = map(int, input().split())
s = input()
count = Counter()
i = 0
while i < n:
	st = s[i]
	j = i
	cnt = 0
	while j < n and s[j] == s[i]:
		cnt += 1
		j += 1
		if cnt == k:
			count[st * cnt] += 1
			break
	i = max(i + 1, j)
if len(count.values()):
	print(max(count.values()))
else:
	print(0)


entrada = input()
entrada = [int(x) for x in entrada.split()]
n = entrada[0]
k = entrada[1]
s = input()
letters = 'abcdefghijklmnopqrstuvwxyz'

def sub_level(letter):
	blocks = 0
	counter = 0
	for x in s:
		if x == letter:
			counter += 1
		else:
			counter = 0
		if counter == k:
			blocks += 1
			counter = 0
	return blocks
print(max([sub_level(letter) for letter in letters]))


from itertools import combinations
from sys import stdin
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())
(n, k) = listIn()
s = input()
di = {}
for ch in s:
	if ch not in di:
		di[ch] = 1
	else:
		di[ch] += 1
li = []
for ch in list(di.keys()):
	if di[ch] >= k:
		li.append(ch)
if len(li) == 0:
	print(0)
	exit(0)
mlevel = float('-inf')
for ch in li:
	count = 0
	cnt = 0
	t = 0
	for i in range(n):
		if s[i] == ch:
			cnt += 1
			t += 1
		else:
			cnt = 0
		if cnt == k:
			count += 1
			cnt = 0
		if t == di[ch]:
			break
	mlevel = max(count, mlevel)
print(mlevel)


nums = input().split()
n = int(nums[0])
k = int(nums[1])
letters = input()
multiples = {}
current = ''
counter = 0
for i in range(n):
	if letters[i] == current:
		counter += 1
	else:
		multiples[current] = multiples.get(current, 0) + counter // k
		current = letters[i]
		counter = 1
multiples[current] = multiples.get(current, 0) + counter // k
maximum = 0
for key in multiples:
	if multiples[key] > maximum:
		maximum = multiples[key]
print(maximum)


from collections import defaultdict
(n, k) = map(int, input().split())
s = input()
d = defaultdict(int)
sample = s[0]
count = 1
for i in range(1, n):
	if s[i] == sample[-1]:
		count += 1
	else:
		d[s[i - 1]] += count // k
		count = 1
		sample = s[i]
if count:
	d[s[-1]] += count // k
if len(set(s)) == 1:
	print(n // k)
else:
	print(max(d.values()))


(n, k) = [int(i) for i in input().strip().split()]
string = input().strip()
ctr = 1
str_dict = dict()
if len(string) == 1:
	if k == 1:
		print(1)
else:
	if k == 1:
		for i in range(len(string)):
			if string[i] not in str_dict:
				str_dict[string[i]] = 1
			else:
				str_dict[string[i]] += 1
	else:
		for i in range(1, len(string)):
			if string[i - 1] == string[i]:
				ctr += 1
			else:
				ctr = 1
			if ctr == k:
				if string[i] not in str_dict:
					str_dict[string[i]] = 1
				else:
					str_dict[string[i]] += 1
				ctr = 0
	print(0 if str_dict == dict() else max(str_dict.values()))


(n, k) = [int(x) for x in input().split()]
s = input()
alpha = 'abcdefghijklmnopqrstuvwxyz'
S = []
for j in range(26):
	S.append([])
best = 0
for j in alpha:
	got = 0
	total = 0
	for i in range(n):
		if s[i] == j:
			got += 1
			if got == k:
				got = 0
				total += 1
		else:
			got = 0
	best = max(best, total)
print(best)


(n, k) = map(int, input().split())
s = input()
ans = dict()
for i in range(97, 123):
	ans[chr(i)] = 0
ch = '`'
d = 0
for i in range(n):
	if s[i] == ch:
		d += 1
	else:
		ch = s[i]
		d = 1
	if d == k:
		d -= k
		if ch in ans:
			ans[ch] += 1
x = 0
for i in ans:
	x = max(x, ans[i])
print(x)


def solve(s, k):
	counters = [0] * 26
	counter = 0
	state = None
	for ele in s:
		if ele != state:
			state = ele
			counter = 1
		else:
			counter += 1
		if counter == k:
			counters[ord(ele) - ord('a')] += 1
			counter = 0
	return max(counters)

def main():
	(n, k) = map(int, input().split())
	s = input()
	print(solve(s, k))
main()


k = int(input().split()[1])
d = {}
p = l = 0
for c in input() + '#':
	if c != p:
		d[p] = d.get(p, 0) + l // k
		l = 0
		p = c
	l += 1
print(max(d.values()))


from collections import Counter
(n, k) = map(int, input().split())
s = input() + ' '
m1 = 0
m2 = Counter()
sym = ''
sym2 = ''
for x in s:
	if x == sym:
		m1 += 1
	else:
		if sym in m2:
			m2[sym] += (m1 + 1) // k
		else:
			m2[sym] = (m1 + 1) // k
		sym2 = sym
		m1 = 0
	sym = x
print(m2.most_common(1)[0][1])


import string
(n, k) = map(int, input().split())
s = input()
l = list(string.ascii_lowercase)
maxi = 0
for x in l:
	i = 0
	j = 0
	count = 0
	count1 = 0
	while j < n:
		if s[j] == x:
			count += 1
			if count == k:
				count1 += 1
				j += 1
				i = j
				count = 0
			else:
				j += 1
		else:
			j += 1
			i = j
			count = 0
	maxi = max(maxi, count1)
print(maxi)


import math
inp = input().split(' ')
(n, k) = (int(inp[0]), int(inp[1]))
a = input()
a = list(a)
x = 1
cnt = [0] * 26
for i in range(1, n):
	if a[i] == a[i - 1]:
		x += 1
	else:
		cnt[ord(a[i - 1]) - ord('a')] += math.trunc(x / k)
		x = 1
cnt[ord(a[n - 1]) - ord('a')] += math.trunc(x / k)
print(max(cnt))


(n, k) = map(int, input().split())
s = input()
char = {}
i = j = 0
while i < n:
	j = i
	while j < n and s[j] == s[i]:
		j += 1
	count = (j - i) // k
	if s[i] in char:
		char[s[i]] += count
	else:
		char[s[i]] = count
	i = j
print(max(char.values()))


(a, b) = map(int, input().split())
c = input()
otv = dict()
for i in range(97, 123):
	otv[chr(i)] = 0
pred = ''
cnt = 1
for i in c:
	if pred != '':
		if i == pred:
			cnt += 1
		else:
			otv[pred] += cnt // b
			cnt = 1
	pred = i
otv[pred] += cnt // b
print(max(otv.values()))


import math
from collections import defaultdict
(n, k) = list(map(int, input().split()))
s = input()
cur = None
cur_l = 0
lvls = defaultdict(int)
for i in range(n):
	if s[i] != cur:
		cur = s[i]
		cur_l = 1
	else:
		cur_l += 1
	if cur_l == k:
		lvls[cur] += 1
		cur = None
		cur_l = 0
try:
	print(max(lvls.values()))
except ValueError:
	print(0)


from collections import defaultdict
(n, k) = map(int, input().split())
s = input()
l = []
curr = s[0]
i = 0
while i < n:
	j = i + 1
	if j >= n:
		l.append((s[i], 1))
	elif s[i] != s[j]:
		l.append((s[i], 1))
	else:
		count = 1
		while j < n and s[j] == s[i] and (count < k):
			count += 1
			j += 1
		l.append((s[i], count))
	i = j
f = 0
for i in l:
	if i[1] >= k:
		f = 1
		break
if f == 0:
	print(0)
	exit(0)
else:
	ll = [i for i in l if i[1] >= k]
	ll.sort(key=lambda x: x[0])
level = -1
freq = defaultdict()
for i in ll:
	(x, y) = (i[0], i[1])
	if x in freq:
		freq[x] += 1
	else:
		freq[x] = 1
maxi = -1
for (k, v) in freq.items():
	maxi = max(v, maxi)
print(maxi)


from collections import *

class Defaultdict(defaultdict):

	def Dictmax(self):
		ans = 0
		for value in self.values():
			ans = max(value, ans)
		return ans
Dict = Defaultdict(lambda : 0)
(n, k) = map(int, input().split())
Str = deque(input())
while len(Str):
	Char = Str.popleft()
	flag = 1
	for i in range(k - 1):
		if not len(Str) or not Str[0] == Char:
			flag = 0
			break
		Str.popleft()
	if flag:
		Dict[Char] += 1
print(Dict.Dictmax())


(n, k) = map(int, input().split())
string = input()
d = {}
s = 1
if k == 1:
	for i in string:
		try:
			d[i] += 1
		except:
			d[i] = 1
else:
	for i in range(1, n):
		if string[i - 1] == string[i]:
			if s <= 0:
				s += 2
			else:
				s += 1
		else:
			s = 0
		if s == k:
			if i + 1 < n and string[i] == string[i + 1]:
				s = -1
			else:
				s = 0
			try:
				d[string[i]] += 1
			except:
				d[string[i]] = 1
ans = 0
for (i, j) in d.items():
	ans = max(ans, j)
print(ans)


x = [int(s) for s in input().split()]
y = x[1]
s = input()
r = []
c = 1
m = 0
d = '_'
for i in s:
	if i == d:
		c += 1
	elif d == '_':
		d = i
	else:
		r.append((c, d))
		c = 1
		d = i
r.append((c, d))
for i in 'abcdefghijklmnopqrstuvwxyz':
	tm = 0
	for (f, l) in r:
		if f >= y and i == l:
			tm += f // y
	m = max(m, tm)
print(m)


import string
import sys
input = sys.stdin.readline
(n, k) = list(map(int, input().strip().split()))
s = str(input().strip())
j = 0
v = []
for i in range(len(s)):
	if i == len(s) - 1 or s[i] != s[i + 1]:
		v.append((ord(s[j]) - ord('a'), s[j:i + 1]))
		j = i + 1
ans = [0 for i in range(26)]
for (x, y) in v:
	ans[x] += len(y) // k
print(max(ans))


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = 1
	for _ in range(t):
		(n, k) = inar()
		arr = input()
		dic = defaultdict(list)
		for i in range(n):
			dic[arr[i]].append(i)
		ans = 0
		for (key, item) in dic.items():
			temp = 0
			i = 0
			j = 1
			while j < len(item):
				if item[j] - item[j - 1] == 1:
					j += 1
					continue
				else:
					temp += (j - i) // k
					i = j
					j += 1
			temp += (j - i) // k
			ans = max(ans, temp)
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, k) = map(int, input().split())
s = input() + '|'
(d, f, v) = ({}, 0, 1)
for i in s:
	if i != f:
		d[f] = d.get(f, 0) + v // k
		f = i
		v = 1
	else:
		v += 1
print(max(d.values()))


(n, k) = map(int, input().split())
(s, tmp, lis, a) = (input() + '.', 1, [], [0] * 26)
for i in range(len(s) - 1):
	if s[i] == s[i + 1]:
		tmp += 1
	else:
		if tmp >= k:
			lis.append([s[i], tmp])
		tmp = 1
for i in lis:
	a[ord(i[0]) - 97] += i[1] // k
print(max(a))


(n, k) = map(int, input().split())
s = input()
s = s + '5'
arr = [0] * 26
c = 1
for i in range(1, n + 1):
	if s[i - 1] == s[i]:
		c += 1
	else:
		arr[ord(s[i - 1]) - 97] += c // k
		c = 1
mc = 0
for i in range(26):
	mc = max(mc, arr[i])
print(mc)


from sys import *
from math import *
from collections import *
from bisect import *
INF = maxsize

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def input():
	return stdin.readline().strip()
mod = 1000000007
from string import *
(n, k) = get_ints()
s = input()
ans = 0
for letter in ascii_lowercase:
	curr = 0
	cnt = 0
	for i in range(n):
		if s[i] == letter:
			curr += 1
			if curr == k:
				cnt += 1
				curr = 0
		else:
			curr = 0
	ans = max(ans, cnt)
print(ans)


letter = 'abcdefghijklmnopqrstuvwxyz'
(n, m) = map(int, input().split())
string = input()
level = -1
for l in letter:
	temp = 0
	k = 0
	for s in string:
		if l == s:
			k += 1
			if k % m == 0:
				temp += 1
				k = 0
		else:
			k = 0
	level = max(level, temp)
print(level)


from collections import Counter
(n, k) = (int(x) for x in input().split())
s = input()
prev_letter = '1'
block_len = 0
letter___level = Counter()
letter___level['1'] = 0
for sym in s:
	if sym != prev_letter:
		prev_letter = sym
		block_len = 1
	else:
		block_len += 1
	if block_len == k:
		letter___level[sym] += 1
		block_len = 0
print(max(letter___level.values()))


import sys
(n, k) = map(int, sys.stdin.readline().split())
s = sys.stdin.readline().strip()

def getLevel(n, k, s):
	pos = 0
	lastCh = s[0]
	subStrings = {}
	for code in range(ord('a'), ord('z') + 1):
		subStrings[chr(code)] = []
	lastCombo = 0
	while pos < n:
		while pos < n and lastCh == s[pos]:
			pos += 1
			lastCombo += 1
		if lastCombo >= k:
			subStrings[lastCh].append(lastCombo)
		if pos < n:
			lastCh = s[pos]
			lastCombo = 0
	maxLevel = 0
	for letter in subStrings:
		tmpMax = 0
		for length in subStrings[letter]:
			tmpMax += length // k
		if tmpMax > maxLevel:
			maxLevel = tmpMax
	return maxLevel
print(getLevel(n, k, s))


def recode(s):
	all_chunks = list()
	prev_char = 1
	chunk = ''
	for c in s:
		if c == prev_char:
			chunk += c
		else:
			if len(chunk) > 0:
				all_chunks.append(chunk[:])
			chunk = c
		prev_char = c
	if len(chunk) > 0:
		all_chunks.append(chunk[:])
	return all_chunks
k = int(input().strip().split()[1])
s = input()
chunks = recode(s)
l2n = {}
for ch in chunks:
	if len(ch) >= k:
		l = ch[0]
		if not l in l2n:
			l2n[l] = 0
		l2n[l] += len(ch) // k
if len(l2n) == 0:
	print(0)
else:
	print(max([l2n[x] for x in l2n]))


b = [0] * 30
(n, k) = map(int, input().split())
cnt = 1
a = input()
a += '#'
for i in range(0, len(a) - 1):
	if cnt == k:
		b[ord(a[i]) - ord('a')] += 1
		cnt = 1
	elif a[i] == a[i + 1]:
		cnt += 1
	else:
		cnt = 1
print(max(b))


(n, k) = list(map(int, input().split()))
a = input()
d = {}
t = ''
s = 0
for i in range(len(a)):
	if len(t) > 0 and a[i] != t[-1]:
		t = str(a[i])
		s = 1
		continue
	else:
		t += a[i]
		s += 1
		if s == k:
			d[t] = 0
			s = 0
			t = ''
t = ''
s = 0
for i in range(len(a)):
	fl = True
	if len(t) > 0 and a[i] != t[-1]:
		fl = False
		t = str(a[i])
		s = 1
		continue
	t += a[i]
	s += 1
	if s == k:
		if fl == True:
			d[t] += 1
		s = 0
		t = ''
s = 0
for i in d:
	s = max(s, d[i])
print(s)


(n, k) = map(int, input().split())
s = input()
chars = [0] * 26
i = 0
while i <= n - k:
	c = s[i]
	for j in range(i, i + k):
		if s[j] != c:
			i = j
			break
	else:
		i += k
		chars[ord(c) - ord('a')] += 1
print(max(chars))


(n, k) = map(int, input().split())
a = input()
d = {}
(i, j) = (0, 0)
while i < len(a):
	j = i
	while j < len(a) and a[j] == a[i]:
		j += 1
	c = (j - i) // k
	if a[i] in d:
		d[a[i]] += c
	else:
		d[a[i]] = c
	i = j
print(max(d.values()))


(n, k) = map(int, input().split())
a = input()
a += '0'
t = 0
c = []
for i in range(0, n):
	t += 1
	if a[i] != a[i + 1]:
		if t >= k:
			c.append([a[i], t // k])
		t = 0
maxx = t = 0
if c != []:
	c = sorted(c)
	c.append(['0', '0'])
	for i in range(0, len(c) - 1):
		t += c[i][1]
		if c[i][0] != c[i + 1][0]:
			if t > maxx:
				maxx = t
			t = 0
print(maxx)


line = input().split()
n = int(line[0])
k = int(line[1])
s = input()
s += '2'
curr = 0
currch = '1'
segments = []
for ch in s:
	if ch != currch and currch != '1':
		segments.append((currch, curr))
		currch = ch
		curr = 1
	elif currch == '1':
		currch = ch
		curr = 1
	else:
		curr += 1
alf = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
best = 0
for test in alf:
	tot = 0
	for seg in segments:
		if seg[0] == test:
			tot += seg[1] // k
	if tot > best:
		best = tot
print(best)


import collections
(n, k) = list(map(int, input().split(' ')))
s = input()
c = 0
i = 1
l = []
if n == 1:
	print('1')
else:
	while i <= n:
		d = int(k)
		j = int(i)
		while j < n and s[j] == s[j - 1] and (d != 1):
			d -= 1
			j += 1
		if d == 1:
			l.append(s[i - 1:j])
		i = int(j + 1)
	if len(l) == 0:
		print('0')
	else:
		e = collections.Counter(l)
		b = list(e.values())
		print(max(b))


(n, k) = [int(i) for i in input().split()]
s = input()
previ = s[0]
l = [(s[0], 0)]
for i in s:
	if i != previ:
		l.append((i, 1))
		previ = i
	else:
		l[-1] = (l[-1][0], l[-1][1] + 1)
l = [i for i in l if i[1] >= k]
if l == []:
	print(0)
	exit()
l.sort()
previ = l[0][0]
t = 0
j = []
for (i, b) in l:
	if previ == i:
		t += b // k
	else:
		j.append(t)
		previ = i
		t = b // k
j.append(t)
print(max(j))


import sys
patternDB = {}
rankDB = {}

def p_int(x):
	return abs(int(x))

def groupString(_s):
	_s += ' '
	count = 1
	for index in range(len(_s) - 1):
		if _s[index] not in patternDB:
			patternDB[_s[index]] = {}
		if _s[index + 1] == _s[index]:
			count += 1
			continue
		else:
			if count not in patternDB[_s[index]]:
				patternDB[_s[index]][count] = 1
			else:
				patternDB[_s[index]][count] += 1
			count = 1

def getRanks(_patternDB, k):
	for key in _patternDB.keys():
		rank = 0
		for patternLength in _patternDB[key]:
			rank += int(patternLength / k) * _patternDB[key][patternLength]
		rankDB[key] = rank
firstLine = input()
secondLine = input()
n = p_int(firstLine.split(' ')[0])
k = p_int(firstLine.split(' ')[1])
s = secondLine
groupString(s)
getRanks(patternDB, k)
print(max(rankDB.values()))


(n, k) = list(map(int, input().split()))
s = input() + '|'
prev = ''
d = {}
for c in s:
	if c == prev:
		d[c][-1] += 1
	else:
		d[c] = d.get(c, []) + [1]
	prev = c
res = 0

def f(l):
	return sum((e // k for e in l))
for l in list(d.values()):
	res = max(res, f(l))
print(res)


(n, k) = map(int, input().split())
s = input()
res = {}
if k == 1:
	for i in range(n):
		if s[i] in res:
			res[s[i]] = res[s[i]] + 1
		else:
			res[s[i]] = 1
	maximum = 0
	for z in res:
		maximum = max(maximum, res[z])
	print(maximum)
	exit()
i = 0
while i <= n - k:
	t = s[i]
	if t not in res:
		res[t] = 0
	j = i + 1
	while j < i + k:
		if s[i] != s[j]:
			break
		else:
			j = j + 1
	if j == i + k:
		res[t] = res[t] + 1
	i = j
maximum = 0
for z in res:
	maximum = max(maximum, res[z])
print(maximum)


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
except Exception:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(N, K) = getIntList()
S = input()
nc = ' '
sss = 'abcdefghijklmnopqrstuvwxyz'
dr = dict()
for c in sss:
	dr[c] = 0
tn = 0
for x in S:
	if x != nc:
		nc = x
		tn = 1
	else:
		tn += 1
	if K == tn:
		dr[x] += 1
		tn = 0
r = max(dr.values())
print(r)


(n, k) = map(int, input().split())
s = input()
anslevel = 0
for c in range(ord('a'), ord('z') + 1):
	ch = chr(c)
	(nowLen, level) = (0, 0)
	for i in s:
		if i == ch:
			nowLen += 1
			if nowLen == k:
				nowLen = 0
				level += 1
		else:
			nowLen = 0
	anslevel = max(anslevel, level)
print(anslevel)


(n, k) = map(int, input().split())
s = input()
cnt = {}
i = 0
c = 0
b = ''
while i < n:
	if not b:
		b = s[i]
	if b != s[i]:
		c = 1
		b = s[i]
	else:
		c += 1
	if c == k:
		cnt[b] = cnt.get(b, 0) + 1
		c = 0
		b = ''
	i += 1
if len(cnt) == 0:
	print(0)
else:
	print(max(cnt.items(), key=lambda x: x[1])[1])


(n, k) = list(map(int, input().split()))
s = input()
N = 26
level = [0] * N
shift = ord('a')
end_seq_len = 0
last_char_read = ''
for i in range(len(s)):
	next = s[i]
	if next != last_char_read:
		if k == 1:
			level[ord(next) - shift] += 1
		else:
			end_seq_len = 1
	else:
		end_seq_len += 1
		if end_seq_len == k:
			level[ord(next) - shift] += 1
			end_seq_len = 0
	last_char_read = next
print(max(level))


Dato = input()
S = input()
Dato = Dato.split()
N = int(Dato[1])
Diccionario = {}
cont = 0
prev = S[0]
for letra in S:
	if letra == prev:
		cont += 1
	else:
		prev = letra
		cont = 1
	if cont == N:
		cont = 0
		if letra not in Diccionario:
			Diccionario[letra] = 1
		else:
			Diccionario[letra] += 1
max = 0
for letra in Diccionario:
	if Diccionario[letra] > max:
		max = Diccionario[letra]
print(max)


(n, k) = [int(a) for a in input().split()]
s = input()
freq = {}
for c in 'abcdefghijklmnopqrstuvwxyz':
	freq[c] = 0
prev = '!'
run = 0
for x in s:
	if x == prev:
		run += 1
	else:
		prev = x
		run = 1
	if run == k:
		freq[x] += 1
		run = 0
print(max(freq.values()))


from collections import defaultdict
(n, k) = [int(x) for x in input().split()]
s = input()
d = defaultdict(int)
level = 0
p = s[0]
count = 0
for i in s:
	if i == p:
		count += 1
		if count == k:
			d[i] += 1
			count = 0
			p = i
	else:
		count = 1
		if count == k:
			d[i] += 1
			count = 0
		p = i
if len(d) == 0:
	print(0)
else:
	print(max(d.values()))


import copy
import itertools
import string

def powmod(x, p, m):
	if p <= 0:
		return 1
	if p <= 1:
		return x % m
	return powmod(x * x % m, p // 2, m) * (x % m) ** (p % 2) % m

def to_basex(num, x):
	while num > 0:
		yield (num % x)
		num //= x

def from_basex(it, x):
	ret = 0
	p = 1
	for d in it:
		ret += d * p
		p *= x
	return ret

def core():
	(n, k) = (int(x) for x in input().split())
	s = input()
	ansd = {l: 0 for l in string.ascii_lowercase}
	for l in string.ascii_lowercase:
		cnt = 0
		for ch in s:
			if ch == l:
				cnt += 1
				if cnt >= k:
					ansd[l] += 1
					cnt = 0
			else:
				cnt = 0
	ans = max(ansd.values())
	print(ans)
core()


(n, k) = map(int, input().split())
s = input()
level = [0] * 26
(i, ans) = (0, 0)
while i < n:
	j = i + 1
	while j < n and s[j] == s[i]:
		j = j + 1
	x = ord(s[i]) - ord('a')
	level[x] = level[x] + int((j - i) / k)
	ans = max(ans, level[x])
	i = j
print(ans)


from collections import defaultdict

def read_nums():
	return [int(x) for x in input().split()]

def calculate_level(consecutives, k):
	res = 0
	for length in consecutives:
		if length >= k:
			res += length // k
	return res

def count_consecutives(nums):
	count = 1
	res = []
	for i in range(1, len(nums)):
		if nums[i - 1] + 1 == nums[i]:
			count += 1
		else:
			res.append(count)
			count = 1
	res.append(count)
	return res

def main():
	(n, k) = read_nums()
	s = input()
	c = defaultdict(list)
	for (index, ch) in enumerate(s):
		c[ch].append(index)
	c = {key: calculate_level(count_consecutives(sorted(val)), k) for (key, val) in c.items()}
	print(max(c.values()))
main()


(n, k) = list(map(int, input().split()))
L = list(input())
D = {'a': 0}
a = 0
while a < len(L):
	b = a
	while b + 1 < len(L) and L[b] == L[b + 1]:
		b += 1
	if b - a + 1 >= k:
		if L[a] in D:
			D[L[a]] += (b - a + 1) // k
		else:
			D[L[a]] = (b - a + 1) // k
	a = b
	a += 1
print(max(D.values()))


(n, k) = map(int, input().split())
line = input()
(d, curr, count, maxv) = ({x: 0 for x in set(line)}, '\n', 0, 0)
for i in range(n):
	if curr == line[i]:
		count += 1
	else:
		curr = line[i]
		count = 1
	if count == k:
		d[curr] += 1
		count = 0
		if d[curr] > maxv:
			maxv = d[curr]
print(maxv)


import string

def main():
	arr = [0 for _ in range(26)]
	refe = list(string.ascii_lowercase)
	line = input().split()
	n = int(line[0])
	k = int(line[1])
	line = input()
	identity = ''
	length = 0
	for x in range(n):
		if line[x] == identity:
			length += 1
		else:
			identity = line[x]
			length = 1
		if length == k:
			arr[refe.index(identity)] += 1
			identity = ''
			length = 0
	print(max(arr))
main()


(n, k) = map(int, input().split())
s = input()
cnt = {}
start = 0
for i in range(n):
	if s[start] != s[i]:
		if i - start >= k:
			if s[start] not in cnt:
				cnt[s[start]] = (i - start) // k
			else:
				cnt[s[start]] += (i - start) // k
		start = i
if n - start >= k:
	if s[start] not in cnt:
		cnt[s[start]] = (n - start) // k
	else:
		cnt[s[start]] += (n - start) // k
if cnt:
	print(max(cnt.values()))
else:
	print(0)


(n, k) = map(int, input().split())
data = input()
bag = dict()
prev = data[0]
val = 1
for q in range(1, n):
	if data[q] == prev:
		val += 1
	else:
		if prev in bag:
			bag[prev].append(val)
		else:
			bag[prev] = [val]
		val = 1
		prev = data[q]
if prev in bag:
	bag[prev].append(val)
else:
	bag[prev] = [val]
ans = 0
for (key, val) in bag.items():
	temp = 0
	for q in val:
		temp += q // k
	ans = max(ans, temp)
print(ans)


(n, k) = [int(tmp) for tmp in input().split()]
s = input()
sf = [0] * 26
cc = [0] * 26
pch = '-'
for ch in s:
	cho = ord(ch) - ord('a')
	if ch == pch:
		cc[cho] += 1
	elif pch != '-':
		cc[ord(pch) - ord('a')] = 0
	if cc[cho] == k - 1:
		sf[cho] += 1
		cc[cho] = 0
		ch = '-'
	pch = ch
print(max(sf))


import itertools
(n, k) = list(map(int, input().split()))
s = input().strip()
resdict = {}
for (c, g) in itertools.groupby(s):
	count = len(list(g))
	if c not in resdict:
		resdict[c] = 0
	resdict[c] += count // k
print(max(resdict.values()))


[N, K] = list(map(int, input().split(' ')))
text = input()
prev = ''
consec = 0
level = {}
for char in text:
	if prev == char:
		consec += 1
	else:
		prev = char
		consec = 1
	if consec >= K:
		if prev not in level:
			level[prev] = 0
		level[prev] += 1
		consec -= K
ret = 0
for char in range(ord('a'), ord('z') + 1):
	char = chr(char)
	if char in level:
		ret = max(ret, level[char])
print(ret)


ar = [int(e) for e in input().split()]
s = input()
m = {}
t = 0
for i in range(1, ar[0]):
	if s[i] == s[t] and i - t < ar[1]:
		continue
	if i - t == ar[1]:
		if s[t] in m:
			m[s[t]] += 1
		else:
			m[s[t]] = 1
	t = i
if ar[0] - t == ar[1]:
	if s[t] in m:
		m[s[t]] += 1
	else:
		m[s[t]] = 1
if len(m) == 0:
	print(0)
else:
	print(max(m.values()))


(n, k) = map(int, input().split())
(a, c1, L) = ({}, '!', 0)
for c2 in input() + '.':
	if c1 != c2:
		a[c1] = a.get(c1, 0) + L // k
		(L, c1) = (0, c2)
	L += 1
print(max(a.values()))


(n, k) = input().split()
(n, k) = (int(n), int(k))
s = input() + ' '
d = {}
prev = '!'
cont = 0
for char in s:
	if char != prev or cont >= k:
		if cont >= k:
			if prev in d:
				d[prev] += 1
			else:
				d[prev] = 1
		prev = char
		cont = 1
	else:
		cont += 1
print(max(list(d.values()) + [0]))


def main():
	(n, k) = [int(a) for a in input().split()]
	s = input()
	sameCharLen = {s[0]: [1]}
	for i in range(1, len(s)):
		if s[i - 1] == s[i]:
			sameCharLen[s[i]][-1] += 1
		elif s[i] in sameCharLen:
			sameCharLen[s[i]].append(1)
		else:
			sameCharLen[s[i]] = [1]
	level = 0
	for key in sameCharLen:
		l = sameCharLen[key]
		curr = sum((int(a / k) for a in l))
		if level < curr:
			level = curr
	print(level)
main()


(n, k) = map(int, input().split(' '))
a = list(input())
char = [0 for i in range(26)]
m = a[0]
for i in range(1, n):
	if i == 1:
		if a[i] == a[i - 1]:
			val = 1
	if a[i] == a[i - 1]:
		val += 1
	else:
		val = 1
	if val == k:
		char[ord(a[i]) - 97] += 1
		val = 0
if k == 1:
	max = 0
	for i in range(0, 26):
		if max < a.count(chr(97 + i)):
			max = a.count(chr(97 + i))
	print(max)
else:
	print(max(char))


p = input().rstrip().split(' ')
k = int(p[1])
p = input().rstrip()
x = list(p)
L = []
for j in range(0, 26):
	D = []
	L.append(D)
L = list(L)
for j in range(0, len(x)):
	A = ord(x[j]) - 97
	L[A].append(j)
mini = 0
for i in range(0, len(L)):
	j = 0
	ans = 0
	if len(L[i]) < k:
		continue
	else:
		j = 0
		while j < len(L[i]):
			if j + k <= len(L[i]):
				A = L[i][j]
				B = L[i][j + k - 1]
				if B - A + 1 == k:
					ans += 1
					j += k
				else:
					j += 1
			else:
				break
		if ans > mini:
			mini = ans
print(mini)


(n, k) = map(int, input().split())
seq = input()
sseq = {}
cur = 1
for i in range(1, len(seq)):
	s = seq[i]
	if s == seq[i - 1]:
		cur += 1
	else:
		try:
			sseq[seq[i - 1]] += cur // k
		except KeyError:
			sseq[seq[i - 1]] = cur // k
		cur = 1
try:
	sseq[seq[-1]] += cur // k
except KeyError:
	sseq[seq[-1]] = cur // k
mx = 0
for (key, val) in sseq.items():
	mx = max(val, mx)
print(mx)