import re

# Process input
s, p = input(), input()

# Build regex
sb = []
lastCh = None
for ch in s:
    if ch == '*':
        if lastCh != '*':
            sb.append(r"\w*")
    elif ch == '?':
        sb.append(r"\w")
    elif not ch.isdigit() and not ch.isalpha():
        sb.append(rf"\{ch}")
    else:
        sb.append(ch)
    lastCh = ch

# Match
regexp = ''.join(sb)
res = re.fullmatch(regexp, p, re.I)

# Output
print('true' if res else 'false')