#include <cctype>
#include <iostream>
using namespace std;

bool match(const char* s, const char* p){
    if(*s == '\0' && *p == '\0') return true;
    if(*(s+1) == '\0' && *p == '\0') return true;
    else if(*s == '\0' || *p == '\0') return false;
    if(*s == '?'){
        if(!isdigit(*p) && !isalpha(*p)) return false;
        return match(s+1, p+1);
    }else if(*s == '*'){
        while(*(s+1) == '*') ++s;
        return match(s+1, p) || match(s, p+1);
    }else if(*s == *p){
        return match(s+1, p+1);
    }else if(towlower(*s)==towlower(*p)){
        return match(s+1, p+1);
    }
    return false;
}

int main() {
    string s;
    string p;
    getline(cin, s);
    getline(cin, p);
    if(match(s.c_str(), p.c_str())){
        cout << "true" << endl;
    }else{
        cout << "false" << endl;
    }

    return 0;
}
// 64 位输出请用 printf("%lld")