#include<bits/stdc++.h>
using namespace std;
bool match(const char* s,const char* p)
{
if((*p=='\0')&&(*s=='\0'))return true;
if((*p=='\0')||(*s=='\0'))return false;
if(*p=='?')
{
if(!isdigit(*s)&&!isalpha(*s)) return false;
return match(s+1,p+1);
}
else if(*p=='*')
{
while(*p=='*')p++;
p--;
//匹配0个,匹配1个,匹配多个/-1个,直至1个
return match(s,p+1) || match(s+1,p+1) || match(s+1,p);
}
else if(tolower(*p)==tolower(*s))
return match(s+1,p+1);
return false;
}
int main()
{
string p,s;
while(cin>>p>>s)
{
bool res = match(s.c_str(),p.c_str());
if(res)cout<<"true"<<endl;
else cout<<"false"<<endl;
}
}