Count Of Substrings Having At Most K Unique Characters

easy
1. You are given a string(str) and a number K.
2. You have to find the count of substrings of the given string that contains at most K unique characters.

Input Format

A string A number

Output Format

A number representing the count of substrings with at most K unique characters.

Constraints

1 <= length of string <= 10^5
1 <= K <= 26

Example

Input
aabcbcdbca
2
Output
23
Previous
Longest Substring With At Most K Unique Characters
Next
Count Of Subarrays Having Sum Equals To K

Related Questions