FunctionRacerProblemsRace

Substrings With Every Vowel

MediumStringsPython, JavaScript, TypeScript, Java, C++

Return the number of substrings of s that contain each of the five vowels a, e, i, o, u at least once. A substring is a contiguous piece of s; consonants may appear anywhere inside it. Substrings that start or end at different indexes count separately even when they read the same.

For example "xaeioux" gives 4: the piece aeiou can be extended by the x on the left, the x on the right, both or neither. s has lowercase letters only; return 0 when no substring qualifies.

Example 1

s "xaeioux"
returns 4

The substrings starting at index 0 or 1 and ending at index 5 or 6 all contain every vowel.

Example 2

s "aeiou"
returns 1

Only the whole string has every vowel.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Strings problems