2062. Count Vowel Substrings of a String

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 2062

class Solution:
    def countVowelSubstrings(self, word: str) -> int:
        s = set('aeiou')
        res, n = 0, len(word)
        for i in range(n):
            t = set()
            for c in word[i:]:
                if c not in s:
                    break
                t.add(c)
                res += len(t) == 5
        return res