A deep-space listening post records an incoming beacon transmission as a string of lowercase status letters. Exactly five letters -- a, e, i, o, and u -- represent the five calibration tones of the beacon; every other letter represents ordinary background noise. A calibration window is a contiguous stretch of the transmission that consists entirely of calibration-tone letters and that sounds every one of the five tones at least once somewhere inside it. Count how many contiguous substrings of the transmission qualify as calibration windows.
A single line containing the transmission s.
Print a single integer: the number of calibration windows.
s consists only of lowercase English letters.Example 1
Input
aeiou
Expected
1
Explanation
The only substring using nothing but tone letters and containing all five tones is the entire string `aeiou` itself. Any shorter substring is missing at least one tone, and there is no longer substring to check. Count: 1.
Example 2
Input
aeiouu
Expected
2
Explanation
Two substrings qualify: `aeiou` (the first five characters) and `aeiouu` (all six characters) -- the extra trailing `u` doesn't break the all-tone-letters rule and the window still contains every tone. No substring that drops the leading `a` can qualify, since `a` never reappears. Count: 2.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →