aoc

Advent of Code Solutions
git clone git://git.alexkarle.com.com/aoc
Log | Files | Refs | README | LICENSE

1.py (202B) [raw]


      1 #!/usr/bin/env python3
      2 import sys
      3 import re
      4 
      5 t = 0
      6 r = re.compile('mul\((\d{1,3}),(\d{1,3})\)')
      7 
      8 for l in sys.stdin:
      9     for m in r.finditer(l):
     10         t += int(m.group(1)) * int(m.group(2))
     11 
     12 print(t)