Count All-Vowel Substrings Containing Every Vowel. Count the nonempty contiguous substrings of lowercase word that consist only of a,e,i,o,u and contain all five of these vowels at least once. Count different positions separately.
### Problem
Given a lowercase English string `word`, count its nonempty contiguous substrings that contain only vowels and include each of `a`, `e`, `i`, `o` and `u` at least once. Substrings with different start or end positions count separately, even when their text is identical.
```cpp
class Solution {
public:
int countVowelSubstrings(string word);
};
```
### Examples
**Example 1:**
```text
word = "aeiou"
Output: 1
Explanation: Only the complete five-character string contains every vowel.
```
**Example 2:**
```text
word = "aeiobu"
Output: 0
Explanation: The consonant b separates u from the other four vowels.
```
### Constraints
- `1 <= word.length <= 100`.
- word contains lowercase English letters.
### Clarifying Questions
A substring containing a consonant never qualifies, even if it also contains all vowels.
```hint Inspect the structure
When extending a chosen start position, which character makes every further extension invalid?
```
### Reasoning checkpoints
- Require both the absence of consonants and the presence of all five vowel types.
- Count each valid pair of substring boundaries exactly once, including repeated vowels.
- Explain behavior for short strings and vowel runs separated by consonants.
### Optional extensions
Can you count qualifying substrings in linear time with constant additional storage?
Overview: Count All-Vowel Substrings Containing Every Vowel. Count the nonempty contiguous substrings of lowercase word that consist only of a,e,i,o,u and contain all five of these vowels at least once. Count different positions separately.
Given a lowercase English string word, count its nonempty contiguous substrings that contain only vowels and include each of a, e, i, o and u at least once. Substrings with different start or end positions count separately, even when their text is identical.
class Solution {
public:
int countVowelSubstrings(string word);
};
Examples
Example 1:
word = "aeiou"
Output: 1
Explanation: Only the complete five-character string contains every vowel.
Example 2:
word = "aeiobu"
Output: 0
Explanation: The consonant b separates u from the other four vowels.
Constraints
1 <= word.length <= 100
.
word contains lowercase English letters.
Clarifying Questions Guidance
A substring containing a consonant never qualifies, even if it also contains all vowels.
Reasoning checkpoints
Require both the absence of consonants and the presence of all five vowel types.
Count each valid pair of substring boundaries exactly once, including repeated vowels.
Explain behavior for short strings and vowel runs separated by consonants.
Optional extensions
Can you count qualifying substrings in linear time with constant additional storage?