import sys


s0, s1, *_, = sys.stdin.read().split()
s0, s1 = s0.lower(), s1.lower()
p0, p1 = 0, 0

c = None

while True:
    if p0>=len(s0) or p1>=len(s1):
        if p0==len(s0) and p1==len(s1): break
        if None is c: break
        (s, p0, p1) = c
        s += 1
        c = (s, p0, p1)
        p0+=1
        p1+=s
        if p1>=len(s1): break
        # print("abc", p0, p1, s0[p0], s1[p1], c, s)
        continue

    # print(p0, p1, s0[p0], s1[p1], c)

    a = ord(s1[p1])
    if (a<ord('a') or a>ord('z')) and s1[p1] not in '12.': print("false"); exit()

    if s0[p0] == s1[p1] or '?' == s0[p0]:
        p0+=1
        p1+=1
        continue

    if '*' == s0[p0]:
        s = 0
        c = (s, p0, p1)
        p0+=1
        p1+=s
        continue

    if None is not c:
        (s, p0, p1) = c
        s += 1
        c = (s, p0, p1)
        p0+=1
        p1+=s
        continue

    print("false"); exit()


if p0==len(s0) and p1==len(s1):
    print("true")
else:
    print("false")