progs/catastrophic/catastrophic.py
changeset 753 d94fdbef1a4f
parent 745 7dc3643a0cc5
equal deleted inserted replaced
752:c0bdd4ad69ca 753:d94fdbef1a4f
     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)