public long countVowels(String word) {
    Map<Character, Boolean> map = new HashMap<>();
    map.put('a', true);
    map.put('e', true);
    map.put('i', true);
    map.put('o', true);
    map.put('u', true);
    char[] array = word.toCharArray();
    int n = array.length;
    long ans = 0;
    for (int i = 0; i < n; i++) {
        char key = array[i];
        if (map.containsKey(key)) {
            ans += (i + 1) * (n - i);
        }
    }
    return ans;
}