#P1105B. Zuhair and Strings
Zuhair and Strings
No submission language available for this problem.
Description
Given a string of length and integer (). The string has a level , if is largest non-negative integer, such that it's possible to find in :
- non-intersecting (non-overlapping) substrings of length ,
- all characters of these 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 and (), denoted as = "".
For example, if , then:
- the string "aabb" has level (you can select substring "aa"),
- the strings "zzzz" and "zzbzz" has level (you can select two non-intersecting substrings "zz" in each of them),
- the strings "abed" and "aca" have level (you can't find at least one substring of the length containing the only distinct character).
Zuhair gave you the integer and the string of length . You need to find , the level of the string .
The first line contains two integers and () — the length of the string and the value of .
The second line contains the string of length consisting only of lowercase Latin letters.
Print a single integer — the level of the string.
Input
The first line contains two integers and () — the length of the string and the value of .
The second line contains the string of length consisting only of lowercase Latin letters.
Output
Print a single integer — the level of the string.
Samples
Note
In the first example, we can select non-intersecting substrings consisting of letter 'a': "(aa)ac(aa)bb", so the level is .
In the second example, we can select either substring "a" or "b" to get the answer .