""" advent9.py advent of code day 9 """ import re def dump_exclamation(stream): """ Remove !. from stream. Return new version >>> dump_exclamation('!!abc!abbb') 'abcbbb' """ return re.sub(r'!.', '', stream) # test regular expression in python : # print re.sub(r'^(.*)(ab)(cd)(.*)$', # r'\1\3\2\4', "__abcde__") def main(): data = open("day9_input.txt").read() if __name__ == "__main__": import doctest doctest.testmod() main()