import
java.util.*;
public
class
Main {
public
static
boolean
isVowel(
char
c) {
if
(c ==
'a'
|| c ==
'e'
|| c ==
'i'
|| c ==
'o'
|| c ==
'u'
) {
return
true
;
}
else
{
return
false
;
}
}
public
static
int
solve(String A, String B) {
if
(A.equals(B)) {
return
0
;
}
int
n = A.length(), minOp = Integer.MAX_VALUE, cnt =
0
;
String P =
""
, Q =
""
;
for
(
int
j =
0
; j <
26
; j++) {
P = A; Q = B;
cnt =
0
;
for
(
int
i =
0
; i < n; i++) {
if
(P.charAt(i) ==
'?'
) {
P = P.substring(
0
, i) + (
char
)(
'a'
+ j) + P.substring(i+
1
);
}
if
(Q.charAt(i) ==
'?'
) {
Q = Q.substring(
0
, i) + (
char
)(
'a'
+ j) + Q.substring(i+
1
);
}
}
for
(
int
i =
0
; i < n; i++) {
if
(P.charAt(i) == Q.charAt(i)) {
continue
;
}
else
if
((isVowel(P.charAt(i)) && isVowel(Q.charAt(i)))
|| (!isVowel(P.charAt(i))
&& !isVowel(Q.charAt(i)))) {
cnt +=
2
;
}
else
{
cnt +=
1
;
}
}
minOp = Math.min(minOp, cnt);
}
return
minOp;
}
public
static
void
main(String[] args) {
String A =
"ab?c?"
, B =
"aeg?k"
;
System.out.println(solve(A, B));
A =
"am??x"
; B =
"xd?fc"
;
System.out.println(solve(A, B));
A =
"a?pc?"
; B =
"qfc?d"
;
System.out.println(solve(A, B));
}
}