A substring is a contiguous (non-empty) sequence of characters within a string.

A vowel substring is a substring that only consists of vowels ('a', 'e', 'i', 'o', and 'u') and has all five vowels present in it.

Given a string word, return the number of vowel substrings in word.

&nbsp;
Example 1:

Input: word = "aeiouu"
Output: 2
Explanation: The vowel substrings of word are as follows (underlined):
- "aeiouu"
- "aeiouu"


Example 2:

Input: word = "unicornarihan"
Output: 0
Explanation: Not all 5 vowels are present, so there are no vowel substrings.


Example 3:

Input: word = "cuaieuouac"
Output: 7
Explanation: The vowel substrings of word are as follows (underlined):
- "cuaieuouac"
- "cuaieuouac"
- "cuaieuouac"
- "cuaieuouac"
- "cuaieuouac"
- "cuaieuouac"
- "cuaieuouac"


&nbsp;
Constraints:


	1 &lt;= word.length &lt;= 100
	word consists of lowercase English letters only.


class Solution:
    def countVowelSubstrings(self, word: str) -> int:
        vowels = {'a','e','i','o','u'}
        pointer = 0
        res = 0
        if len(word) <= 4:
            return 0
        while pointer != len(word)-4:
            # if set(list(word[pointer:pointer+5])) == vowels:
            #     temp = 1
            #     res += 1
            #     while set(list(word[pointer:pointer+temp+5])) == vowels and pointer+temp+4 != len(word):
            #         res += 1
            #         temp += 1
            # elif word[pointer] in vowels:
            #     temp = 1
            #     while set(list(word[pointer:pointer+5+temp])) != vowels:
            #         temp += 1
            #     res += 1
            # pointer += 1
            temp = 0
            if word[pointer] in vowels:
                while temp+pointer != len(word)-4:
                    test_1 = set(list(word[pointer:pointer+temp+5]))
                    test_2 = word[pointer:pointer+temp+5]
                    if set(list(word[pointer:pointer+temp+5])).issubset(vowels): 
                        if set(list(word[pointer:pointer+temp+5])) == vowels:
                            res += 1
                        temp+=1
                    else:
                        break
                    
            pointer += 1
        return res

            
class Solution
{
    public int countVowelSubstrings(String word)
    {
        int vow = 0;
        int n = word.length();
        Set<Character> set = new HashSet<>();
        for(int i = 0; i < n-4; i++)
        {
            set.clear();
            for(int j = i; j < n; j++)
            {
                char ch = word.charAt(j);
                if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
                {
                    set.add(ch);
                    if(set.size() == 5)
                        vow++;
                }
                else
                    break;
            }
        }
        return vow;
    }
}
class Solution {
public:
    int countVowelSubstrings(string word) {
        int n = word.size();
        int res = 0;
        
        unordered_set<char> vowels {'a', 'e', 'i', 'o', 'u'};
        
        for (int i = 0; i < n; i++)
        {
            unordered_set<char> letters;
            // string temp = "";
            for (int j = i; j < n; j++)
            {
                // temp += word[j];
                letters.insert(word[j]);
                if (letters == vowels)
                res++;
            }
        }
        
        return res;
    }
}; 
/**
 * @param {string} word
 * @return {number}
 */
var isVowel = function(c) {
    return (c === 'a' || c === 'e' || c === 'i' || c === 'o' || c === 'u');
}

var countVowelSubstrings = function(word) {
    let vowelMap = new Map();
    let total = 0;
    let totalLen = word.length - 1;
    for(let i = 0 ; i <= totalLen; i++){
        vowelMap.clear();
        for(let j = i; j <= totalLen && isVowel(word[j]); j++){
            vowelMap.set(word[j], (vowelMap.get(word[j]) ?? 0) + 1);
            if(vowelMap.size == 5)
                total++;
        }
    }
    return total;
};
Count Vowel Substrings of a String