C++ Easy and Concise O(N)
when ever i see a vowel i find its contribution in ans . the contribution of a vowel at index i can be calculated as\n(i+1)*(n-i)\n\nclass Solution {\npublic:\n
when ever i see a vowel i find its contribution in ans . the contribution of a vowel at index i can be calculated as\n```(i+1)*(n-i)```\n```\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        \n        int n=word.size();\n        \n        long long  ans=0;\n        for(int i=0;i<n;i++)\n        {\n            if(word[i]==\'a\'||word[i]==\'u\'||word[i]==\'o\'||word[i]==\'i\'||word[i]==\'e\')\n            {\n                long long a=(i+1),b=(n-i);\n                ans+=a*b;\n            }\n        }\n        return ans;\n        \n    }\n};\n```
[]