C++|| Observation Based Solution||TC: O(n) and SC: O(1)
```\nclass Solution {\npublic:\n    long long countVowels(string word) {\n     \n        long long ans =0;\n        int n =word.size();\n        for(int i=0;i<n
```\nclass Solution {\npublic:\n    long long countVowels(string word) {\n     \n        long long ans =0;\n        int n =word.size();\n        for(int i=0;i<n;i+=1)\n        {   \n            // if ith index has vowel\n            // then that vowel is in (i+1)*(n-i) substrings\n            if(word[i]==\'a\' or word[i]==\'e\' or word[i]==\'i\' or word[i]==\'o\' or word[i]==\'u\')\n                ans+=(long long)(i+1)*(long long)(n-i);\n           \n        }\n        \n        return ans;\n    }\n};\n\n
[]