#include <stdio.h>
#include <string.h>
char s1[300],s2[300],s[300];
int check(int x, int y){
if(x+y<-1) return 1;
if(x<0) return 0;
if(s1[x]==s2[y]||s1[x]=='?') return check(x-1,y-1);
if(s1[x]=='*'){
if(check(x-1,y)) return 1; else return check(x,y-1);
}else return 0;
}
int main(){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
scanf("%s%s",s1,s2);
if(strstr(s2,"?")||strstr(s2,"*")){
strcpy(s,s1);
strcpy(s1,s2);
strcpy(s2,s);
}
printf("%s", check(strlen(s1)-1,strlen(s2)-1)?"YES":"NO");
return 0;
}
|