progs/catastrophic/catastrophic.py
changeset 753 30ea6b01db46
parent 745 905b60a029bf
equal deleted inserted replaced
752:1f1a293549c1 753:30ea6b01db46
     1 #!/usr/bin/env python
     1 #!/usr/bin/env python3
     2 
     2 
     3 import re
     3 import re
     4 import sys
     4 import sys
     5 
     5 
     6 # case of catastrophic backtracking in Python
     6 # case of catastrophic backtracking in Python
    17 
    17 
    18 # calling the matching function
    18 # calling the matching function
    19 s = ("a" * int(cn))
    19 s = ("a" * int(cn))
    20 m = re.match('(a*)*b' , s) 
    20 m = re.match('(a*)*b' , s) 
    21 
    21 
    22 print s
    22 print(s)
    23 print m
    23 print(m)