text of lowercase English letters and a number width. Count how many of its substrings of length width (contiguous windows) consist of pairwise distinct letters.
Windows starting at different positions count separately, even if their contents match. If width exceeds the length of the string, the answer is 0.text="banana", width=2 → 5
The windows are ba, an, na, an, na; all five have distinct letters. Identical windows at different places count separately.
text="letter", width=3 → 2
The windows are let, ett, tte, ter; only let and ter qualify.
text="abc", width=5 → 0
A window longer than the string does not fit.
text consists of lowercase English letterstext="banana", width=2
5
Run checks the first 3 tests in your browser. Submit checks all 102 tests on the server, hidden ones included.