JAVA Easy O(n)
```\nclass Solution {\n    public long countVowels(String word) {\n        long ans = 0;\n    \n        HashSet vowel = new HashSet<>();\n        vowel.add(\'a\
```\nclass Solution {\n    public long countVowels(String word) {\n        long ans = 0;\n    \n        HashSet<Character> vowel = new HashSet<>();\n        vowel.add(\'a\'); vowel.add(\'e\'); vowel.add(\'i\'); vowel.add(\'o\'); vowel.add(\'u\');\n        \n        for(int i = 0; i < word.length(); i++){\n            if(vowel.contains(word.charAt(i))){\n                ans += ((long)(word.length() - i) * (i + 1));\n            }\n        }\n        \n        return ans;\n    }\n}
[]