Skip to content

Commit 786c61b

Browse files
committed
fix: issue TheAlgorithms#9844
2 parents e3a45eb + 7c9c36e commit 786c61b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: backtracking/match_word_pattern.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def match_word_pattern(pattern :str, input_string: str) -> bool:
1+
def match_word_pattern(pattern: str, input_string: str) -> bool:
22
"""
33
Determine if a given pattern matches a string using backtracking.
44
@@ -15,6 +15,7 @@ def match_word_pattern(pattern :str, input_string: str) -> bool:
1515
>>> match_word_pattern("GG", "PythonJavaPython")
1616
False
1717
"""
18+
1819
def backtrack(pattern_index, str_index):
1920
if pattern_index == len(pattern) and str_index == len(input_string):
2021
return True
@@ -42,6 +43,8 @@ def backtrack(pattern_index, str_index):
4243
str_map: dict[str,str] = {}
4344
return backtrack(0, 0)
4445

46+
4547
if __name__ == "__main__":
4648
import doctest
49+
4750
doctest.testmod()

0 commit comments

Comments
 (0)