O(n) || C++ || Simple Maths Solution
\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        long long ans = 0 , n = word.size();\n        for(long long i = 0 ; i < n ; i++)\
```\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        long long ans = 0 , n = word.size();\n        for(long long i = 0 ; i < n ; i++)\n            if(word[i] == \'a\' || word[i] == \'e\'  || word[i] == \'o\' || word[i] == \'i\' || word[i] == \'u\')\n                ans += ((i+1)*(n-i));//Number of substrings if the ith index is a vowel\n        return ans;\n    }\n};\n```
[]