class Solution {
public:
bool isMatch(const char *s, const char *p) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if (*p == '*'){//return true;
while(*p == '*') ++p;
if (*p == ' ') return true;
while(*s != ' ' && !isMatch(s,p)){
++s;
}
return *s != ' ';
}
else if (*p == ' ' || *s == ' ') return *p == *s;
else if (*p == *s || *p == '?') return isMatch(++s,++p);
else return false;
}
};