# Longest SubString with At Least K Repeating Characters

Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than k times.

Input:
s = “aaabb”, k = 3

Output:
3

The longest substring is “aaa”, as ‘a’ is repeated 3 times.

Input:
s = “ababbc”, k = 2

Output:
5

The longest substring is “ababb”, as ‘a’ is repeated 2 times and ‘b’ is repeated 3 times.

Input: s = “ababacb” k = 3

• 先遍历一遍计算整个串中出现的次数
• 然后开始从头遍历，找出一个t使得count[ s[t] ] < k
• 找到了，我们就分别计算s[i:t]和s[t+1:j]的最大长度即可
• 没找到，那么说明整个串是符合的，我们直接返回串长度即可
• 递归结束的条件就是当串长度比k小的时候啦。