Broken Compiler or My code is wrong . Please help a samurai _/\_


#1

int Solution::isMatch(const string A, const string B) {

int ans[B.length()+1][A.length()+1];

for(int i=0; i<=B.length(); i++){
for(int j=0; j<=A.length(); j++){
if(i==0 && j==0) ans[0][0] = 1;
else if(i==0) {
ans[i][j] = 0;
}
else if(j==0) {
ans[i][j] = 0;
}
else{
if(B[i-1] == A[j-1]){
ans[i][j] = ans[i-1][j-1];
}
else if(B[i-1] == ‘’){
if(ans[i-1][j-1] == 1 || ans[i][j-1] ==1 || ans[i-1][j] ==1){
ans[i][j] = 1;
}
else{
ans[i][j] = 0;
}
}
else if(B[i-1] == ‘?’){
if( B[i-2] ==’
’){
ans[i][j] = ans[i-1][j];
}
else ans[i][j] = ans[i-1][j-1];
}
else{
ans[i][j] = 0;
}
}
}
}
return ans[B.length()][A.length()];
}

custom input shows : 1
on submission shows : 0

A : “cbccbbbbaa”
B : “?b*??b*aa”


#2

An indented code would be easy to look at