An archivist is cataloguing a long scroll represented as a string s of n lowercase English letters, one rune per position. Five particular letters -- a, e, i, o, u -- are considered resonant runes; every other letter is dormant.
For every contiguous stretch of the scroll (there are exactly n(n+1)/2 such stretches, including single runes and the whole scroll), the archivist counts how many resonant runes that stretch contains. Compute the sum of these counts over every contiguous stretch of the scroll.
A single line containing the string s.
Print a single integer: the sum, over every contiguous stretch of s, of the number of resonant runes it contains.
Example 1
Input
aba
Expected
6
Explanation
The contiguous stretches of 'aba' are: a, b, a, ab, ba, aba, containing 1, 0, 1, 1, 1, 2 resonant runes respectively. Summing gives 1+0+1+1+1+2 = 6.
Example 2
Input
bcd
Expected
0
Explanation
None of the letters b, c, or d are resonant, so every one of the 6 contiguous stretches (b, c, d, bc, cd, bcd) contains zero resonant runes, and the total is 0.
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 →