和Regular Expression Matching类似,不过这里用递归超时
bool isMatch(const char *s, const char *p) {
if(*p=='\0')
return *s=='\0';
if(*p!='*')
return ((*p==*s)||(*p=='?'&&*s!='\0'))&&isMatch(s+1,p+1);
while(*s!='\0'){
if(isMatch(s,p+1))
return true;
s++;
}
return false;
}