string word, mask;
cin >> word >> mask;
for (size_t i = 0; i < mask.size(); ++i) {
if (mask[i] == '?') {
mask[i] = '.';
}
if (mask[i] == '*') {
mask[i] = '.';
mask.insert(i + 1, "*");
}
}
mask += "$";
char *regular = new char[mask.size()];
for (int i = 0; i < mask.size(); ++i) {
regular[i] = mask[i];
}
regex reg = (regular);
regex_match(word, reg) ? cout << "YES" : cout << "NO";