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") S = set( [chr(i) for i in range(ord("a"), ord("z") + 1)] + [chr(i) for i in range(ord("0"), ord("9") + 1)] + [*"."] ) import functools @functools.cache def dfs(s0, s1): # print(s0, s1) if len(s0) == 0 or len(s1) == 0: return len(s0) == 0 and len(s1) == 0 if s1[0] not in S: return False if s0[0] == s1[0]: return dfs(s0[1:], s1[1:]) if "?" == s0[0]: return dfs(s0[1:], s1[1:]) if "*" == s0[0]: for i in range(len(s1)+1): if dfs(s0[1:], s1[i:]): return True return False print("true" if dfs(s0, s1) else "false")