import sys
def get_fmt(fmt_str, input_str):
fmt_len = len(fmt_str)
input_len = len(input_str)
fmt_index = 0
input_index = 0
while fmt_index < fmt_len and input_index < input_len:
if fmt_str[fmt_index] == '?':
fmt_index += 1
input_index += 1
elif fmt_str[fmt_index] == '*':
if fmt_index + 1 < fmt_len:
if fmt_str[fmt_index + 1].isdigit()&nbs***bsp;fmt_str[fmt_index + 1].isalpha():
input_index += 1
fmt_index += 1
else:
if input_str[input_index].isdigit()&nbs***bsp;input_str[input_index].isalpha():
input_index += 1
else:
fmt_index += 1
if fmt_str[fmt_index] != input_str[input_index]:
return 'false'
input_index += 1
else:
return 'true'
else:
if fmt_str[fmt_index] != input_str[input_index]:
return 'false'
input_index += 1
fmt_index += 1
return 'true'
def main():
while True:
str_1 = sys.stdin.readline().strip()
if str_1 == '':
break
str_2 = sys.stdin.readline().strip()
if str_2 == '':
break
print(get_fmt(str_1, str_2))
if __name__ == '__main__':
main()
这个里面有坑,那就是*后面如果是一个字符串或者数字,这个时候*代表匹配一个字符,如果*后面不是字符串或者数字,表示匹配0或者n个字符