8 lines
340 B
Python
8 lines
340 B
Python
|
import re, sys
|
||
|
print(sum(
|
||
|
int(re.search("[0-9]+", line).group())
|
||
|
for line in sys.stdin.readlines()
|
||
|
if all(int(r) <= 12 for r in re.findall(r"[0-9]+(?= red)", line))
|
||
|
and all(int(g) <= 13 for g in re.findall(r"[0-9]+(?= green)", line))
|
||
|
and all(int(b) <= 14 for b in re.findall(r"[0-9]+(?= blue)", line))))
|