c++, easy solution with complete explaination
\nclass Solution {\npublic:\n    long long countVowels(string s) {\n        long long cur=0; // for counting all the vowels in substring \n        int n=s.lengt
```\nclass Solution {\npublic:\n    long long countVowels(string s) {\n        long long cur=0; // for counting all the vowels in substring \n        int n=s.length();\n        long long prev=0; // store number of vowels in substring before current index initial value is 0\n        for(int i=0;i<n;i++)\n        {\n            if(s[i]==\'a\' || s[i]==\'e\' || s[i]==\'i\' || s[i]==\'o\' || s[i]==\'u\')\n            {\n\t\t\t   // if a we have 2 element in a array [1,2] then if we add 3rd element let it be 3 then total number of new substring formed which //include this new eelement is the size of array after adding new element i,e 3 = [1,2,3] , [2,3] , [3]\n\t\t\t   // we add prev sum, [a,b,e] current total vowel sum in all substring is prev=6 now if we add one more vowel [a,b,e,f] now cur=4+prev=6\n                cur+=i+1+prev;\n                prev=i+prev+1;\n            }\n            else\n                cur+=prev;\n        }\n        return cur;\n    }\n};\n\n``````\n\n\n```
['C', 'Counting']