Faster || C++ || O(N) || Using map only
```\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        \n        long long int ans = 0; //This will be the final answer\n        \n  
```\nclass Solution {\npublic:\n    long long countVowels(string word) {\n        \n        long long int ans = 0; //This will be the final answer\n        \n        unordered_map<char , int > mp; // Unordered map of char to int\n        \n        mp[\'a\']=1; mp[\'e\']=1; mp[\'i\']=1; mp[\'o\']=1; mp[\'u\']=1;\n        \n        int n = word.size(); // Size of the word\n        \n        for(int i=0;i<word.size();i++)\n        {\n            if(mp.count(word[i])){  // Checking if current character is vowel or not\n                \n            long long int val = (long long)(i+1)*(n-i);  // Contribution of given character\n             ans += val;  // Incrementing the final answer\n            }                                  \n        }\n        \n        return ans;  // Returning the final answer\n    }\n};
[]