text of lowercase English letters and an integer times. Count the contiguous substrings of text in which **at least one** letter occurs times times or more.
Substrings with the same content but at different positions count separately.
The string can be hundreds of thousands of characters long, so checking every substring will be too slow.text="xyxzy", times=2 → 4
The qualifying substrings are "xyx", "xyxz", "xyxzy" (two xs each) and "yxzy" (two ys), 4 in total.
text="abc", times=1 → 6
With times = 1, all 6 substrings qualify.
text="bbbb", times=3 → 3
text consists of lowercase English letters onlytext="xyxzy", times=2
4
Run checks the first 3 tests in your browser. Submit checks all 83 tests on the server, hidden ones included.