Dynamic programming  easy solution
class Solution {\npublic:\n    long long countVowels(string word) {\n        \n        long long ans=0;\n        \n        set s;\n        \n        s.insert(\'
class Solution {\npublic:\n    long long countVowels(string word) {\n        \n        long long ans=0;\n        \n        set<char> s;\n        \n        s.insert(\'a\');\n        s.insert(\'e\');\n        s.insert(\'i\');\n        s.insert(\'o\');\n        s.insert(\'u\');\n    \n        \n        int n=word.size();\n        \n        vector<long long > dp(n+1);\n        int i;\n        dp[n]=0;\n        \n        for(i=n-1;i>=0;i--){\n            \n            if(s.find(word[i])!=s.end()){\n                dp[i]=(n-i)+dp[i+1];\n            }\n            \n            else dp[i]=dp[i+1];\n            \n            ans+=dp[i];\n            \n            \n        }\n        \n        \n        \n        \n        \n        return ans;\n        \n        \n    }\n};
['Dynamic Programming']