19 lines
306 B
Python
Executable File
19 lines
306 B
Python
Executable File
#!/usr/bin/env python
|
|
import re
|
|
|
|
from common import parse
|
|
|
|
|
|
def solve(input: str) -> int:
|
|
regex = r"mul\((\d+),(\d+)\)"
|
|
muls = re.findall(regex, input)
|
|
return sum(map(lambda x: int(x[0]) * int(x[1]), muls))
|
|
|
|
|
|
def main():
|
|
print(solve(parse("input")))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|