c++ |simple approch without dp simple observation
\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        long long  ans=0;\n        map<char,int>m;\n        m[\'a\']++;\n        m[\'e\']
```\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        long long  ans=0;\n        map<char,int>m;\n        m[\'a\']++;\n        m[\'e\']++;\n        m[\'i\']++;\n        m[\'o\']++;\n        m[\'u\']++;\n        int n=word.length();\n\t\t//we need to check the contribution of every vowels in final ans\n\t\t//__________a[i]____________\n\t\t//suppose a[i] is vowel the we find number of substring such that a[i] is part of ths substring\n\t\t//op1= we find number of substring ending at i so this are i+1;\n\t\t//op2=we find number of substring that start at i so this is n-i-1\n\t\t//op3  we find number of substring such that a[i] is between in string \n\t\t//for this ----------a[i]______________ number of character to left of i and number of\n\t\tcharacter to right of i is total is left*right total answer for this i is sum of abover three options\n        for(int i=0;i<word.length();i++){\n            if(m.count(word[i])){\n                long long a=i+1;\n                long long b=n-i-1;\n                long long c=i*b;\n                ans+=a;\n                ans+=b;\n                ans+=c;\n                \n            }\n        }\n        return ans;\n        \n    }\n};\n\n```
['Math']