1
class Solution {
2

3
boolean isVowel(char ch) {
4
return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
5
}
6

7
public long countVowels(String word) {
8
long count = 0;
9
int len = word.length();
10

11
for (int pos = 0; pos < len; pos++) {
12
if (isVowel(word.charAt(pos))) {
13
count += (long) (len - pos) * (long) (pos + 1);
14
}
15
}
16

17
return count;
18
}
19
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0