Easiest c++ solution 0ms beats 100% solve by counting
IntuitionApproachComplexity
Time complexity: O(n)

Space complexity: O(1)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: $$O(n)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(1)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    long long countVowels(string word) {
        long long ans = 0;
        unordered_set<char> vowel = {'a', 'e', 'i', 'o', 'u'};
        for(int i = 0;i < word.length();i++){
            if(vowel.count(word[i])) ans += (i + 1) * (word.length() - i);
        }

        return ans;
    }
};

auto init = []()
{ 
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    return 'c';
}();
```
['Math', 'String', 'Combinatorics', 'Counting', 'C++']