class Solution {
public boolean halvesAreAlike(String s) {
Set<Character> set = new HashSet<>(Arrays.asList('a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'));
int len = s.length()/2;
int count1 = 0, count2 = 0;
for(int i = 0; i < len; i++){
if(set.contains(s.charAt(i))) ++count1;
if(set.contains(s.charAt(i + len))) ++count2;
}
return count1 == count2;
}
}