def pattern_match(pattern, string):
def backtrack(pattern, string, dic):<EOL><INDENT>if len(pattern) == <NUM_LIT:0> and len(string) > <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>if len(pattern) == len(string) == <NUM_LIT:0>:<EOL><INDENT>return True<EOL><DEDENT>for end in range(<NUM_LIT:1>, len(string)-len(pattern)+<NUM_LIT:2>):<EOL><INDENT>if pattern[<NUM_LIT:0>] not in dic and string[:end] not in dic.values():<EOL><INDENT>dic[pattern[<NUM_LIT:0>]] = string[:end]<EOL>if backtrack(pattern[<NUM_LIT:1>:], string[end:], dic):<EOL><INDENT>return True<EOL><DEDENT>del dic[pattern[<NUM_LIT:0>]]<EOL><DEDENT>elif pattern[<NUM_LIT:0>] in dic and dic[pattern[<NUM_LIT:0>]] == string[:end]:<EOL><INDENT>if backtrack(pattern[<NUM_LIT:1>:], string[end:], dic):<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT>return False<EOL><DEDENT>return backtrack(pattern, string, {})<EOL>
:type pattern: str
:type string: str
:rtype: bool