C++ || Diagram Explanation || O(N)
Consider example : \n"decab"\n       \n\nHere vowels are e and a, so we rehrase the answer are total substrings in which each vowel occur.\n\nSo for "e",\n\n\nl
Consider example : \n"decab"\n![image](https://assets.leetcode.com/users/images/38cb0cc4-f9a8-499e-8537-7311b4c3ae98_1643385527.5234022.png)       \n\nHere vowels are e and a, so we rehrase the answer are total substrings in which each vowel occur.\n\nSo for "e",\n![image](https://assets.leetcode.com/users/images/cceed213-dd2b-4693-aca9-4cf9815d990a_1643385628.7467048.png)\n\nleft end of substring having e has 2 options \nRight end of substring having e has 4 options.\nSo total substring having e can be 2*4 = 8 \n\nSimilarly for "a"\n![image](https://assets.leetcode.com/users/images/322345df-4a50-4987-986b-614458f12f19_1643385717.9626572.png)\n\nThis also has total of 8\n\nSo final answer is 8+8 = 16\n\n```\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        long long int cnt=0;\n        long long int n = word.size();\n        for(int i=0;i<word.size();i++)\n        {\n            if(word[i]==\'a\'||word[i]==\'e\'||word[i]==\'i\'||word[i]==\'o\'||word[i]==\'u\')\n                cnt+=((i+1)*(n-i));\n        }\n        return cnt;\n    }\n};\n```
['C']