import re
def func():
    while True:
        try:
            p, s = str(input()), str(input())
            a = "[a-zA-Z0-9\.]{0,}"
            b = "[a-zA-Z0-9\.]{1}"
            p = p.replace('*', a)
            p = p.replace('?', b)
            x = re.search(p, s, re.I)    #忽略大小写
            if not x:                    #如果没有匹配的则结束
                print('false')
                continue
            if s in x.group():            # 有匹配项则判断匹配项是否存在s
                print('true')
            else:
                print('false')

        except:
            break


if __name__ == '__main__':
    func()