Ctrl K

Stretches With All Five Vowels

Easy
You get a string text of lowercase English letters. The vowels are a, e, i, o and u. Count the non-empty substrings (runs of consecutive characters) that consist of vowels only and contain each of the five vowels at least once. Substrings that start or end at different positions are counted separately, even if their text is the same.
Example 1
text="queueioa" → 3

The vowel run after q is "ueueioa". Only pieces ending at the final a and starting at one of the first three letters u, e, u contain all five vowels: 3 substrings. Starting at the second e already loses the u.

Example 2
text="education" → 0

The word has all five vowels, but consonants split them up, so no consonant-free piece holds them all. The answer is 0.

Example 3
text="aeiouxuoiea" → 2
Constraints
  • 1 ≤ len(text) ≤ 100
  • text consists of lowercase English letters
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsValue of a Roman Numeral EasySame Letter Cipher EasySame Letters, Reshuffled EasySame When Flipped EasyShuffle Into a Palindrome Easy
loading Python…
Input
text="queueioa"
Expected
3

Run checks the first 3 tests in your browser. Submit checks all 112 tests on the server, hidden ones included.