```
class Solution {
public:
bool isMatch(string s, string p) {
if(s.compare(p)) return true;
int ssize = (int) s.size();
int psize = (int) p.size();
int i=0,j=0,pi=0,pj=psize;
while(i<ssize){
if(s[i]==p[j]||p[j]=='?'){
i++;
j++;
continue;
}
if(p[j]=='*'){
pj = j++;
pi = i;
continue;
}
if(pj<psize){
j = pj + 1;
i = ++pi;
continue;
}
return false;
}
while(p[j]=='*'){
j++;
}
return j==psize;
}
};
```