def fun(str1, str2):
    if str1 == '' and str2 == '': # 空模式空字符串,匹配成功
        return True
    elif str1 == '' and str2 != '': # 空模式无法匹配非空字符串
        return False
    elif str1 != '' and str2 == '': # 不确定,只有模式为星号*时,才能匹配空字符串,即模式p前i个字符均为星号*
        if str1.replace('*', '') == '':
            return True
        else:
            return False
    else: # 字符串与通配符均不为空,递归检查
        m, n = len(str1), len(str2)
        if str1[m-1] == str2[n-1] or (str1[m-1] == '?' and str2.isalnum()): # 通配符是问号或者字母数字
            return fun(str1[:m-1], str2[:n-1])
        elif str1[m-1] == '*': # 通配符是星号
            return fun(str1[:m-1], str2) or fun(str1, str2[:n-1])
        else: # 通配符不是问号或者字母数字,还跟字符串匹配不上
            return False
while True:
    try:
        str1, str2 = input().lower(), input().lower()
        if fun(str1, str2):
            print('true')
        else:
            print('false')   
    except:
        break