14 lines
213 B
Python
14 lines
213 B
Python
|
import re
|
||
|
|
||
|
text: str
|
||
|
|
||
|
with open("input.txt") as f:
|
||
|
text = f.read()
|
||
|
|
||
|
total: int = 0
|
||
|
|
||
|
for x, y in re.findall("mul\(([0-9]{0,3})\,([0-9]{0,3})\)", text):
|
||
|
x, y = int(x), int(y)
|
||
|
total += x * y
|
||
|
|
||
|
print(total)
|