import
java.io.*;
import
java.util.*;
class
GFG {
static
int
operations(String s)
{
int
ans =
0
;
int
vowels =
0
, consonants =
0
;
int
max_vowels = Integer.MIN_VALUE;
int
max_consonants = Integer.MIN_VALUE;
HashMap<Character, Integer> freq_consonants
=
new
HashMap<>();
HashMap<Character, Integer> freq_vowels
=
new
HashMap<>();
for
(
int
i =
0
; i < s.length(); i++) {
if
(s.charAt(i) ==
'a'
|| s.charAt(i) ==
'e'
|| s.charAt(i) ==
'i'
|| s.charAt(i) ==
'o'
|| s.charAt(i) ==
'u'
) {
vowels +=
1
;
freq_vowels.put(
s.charAt(i),
freq_vowels.getOrDefault(s.charAt(i),
0
)
+
1
);
}
else
{
consonants +=
1
;
freq_consonants.put(
s.charAt(i),
freq_consonants.getOrDefault(
s.charAt(i),
0
)
+
1
);
}
}
for
(Map.Entry<Character, Integer> it :
freq_consonants.entrySet()) {
max_consonants
= Math.max(max_consonants, it.getValue());
}
for
(Map.Entry<Character, Integer> it :
freq_vowels.entrySet()) {
max_vowels
= Math.max(max_vowels, it.getValue());
}
ans = Math.min(
(
2
* (vowels - max_vowels) + consonants),
(
2
* (consonants - max_vowels) + consonants));
return
ans;
}
public
static
void
main(String[] args)
{
String S =
"geeksforgeeks"
;
System.out.print(operations(S));
}
}