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