Mimi is playing with a string
How many substrings of
are there such that these substrings are of length and have exactly 1 distinct letter?
Constraints
Let
For all subtasks:
Subtask 1 [10%]
Subtask 2 [90%]
Input Specification
The first line of input will contain a single string,
The second line of input will contain an integer,
Output Specification
The number of substrings which satisfy the given condition.
Sample Input
Copy
aaaabb
2
Sample Output
Copy
4
Comments