An alternative simple and clear solution. O(n)
\nclass Solution:\n    def countVowels(self, word: str) -> int:\n        total, cnt_substrig = 0, 0\n        for i, ch in enumerate(word, 1):\n            if ch
```\nclass Solution:\n    def countVowels(self, word: str) -> int:\n        total, cnt_substrig = 0, 0\n        for i, ch in enumerate(word, 1):\n            if ch in {\'a\', \'e\', \'i\', \'o\', \'u\'}:\n                cnt_substrig += i\n            total += cnt_substrig\n        return total    \n```
['Python3']