C++ Solution - O(N) [SIMPLE & CONCISE]
\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        auto isVow = [](char const &c) -> bool {\n            return c == \'a\' || c == \
```\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        auto isVow = [](char const &c) -> bool {\n            return c == \'a\' || c == \'e\' || c == \'i\' || c == \'o\' || c == \'u\';\n        };\n        long long sum = 0, n = word.size();\n        for (long long i = 0; i < n; i++) {\n            if (isVow(word[i])) { //Just count the number of sub-strings, the vowel - word[i] would be associated with;\n                sum = (sum + n + i * (n - i - 1)); // adding \'n\' as word[i] would exist in the sub-string [0...i] & [i + 1...n],\n\t\t\t\t//and multiplying i * (n - i - 1) because, word[i] would also exist in the sub-strings [0...i] * [i + 1...n](i.e [0...i+1],[1...i+1]...[0...n] etc.);\n            }\n        }\n        return sum;\n    }\n};\n\n```
['C']