22 lines
558 B
Python
22 lines
558 B
Python
import sys
|
|
|
|
|
|
R = 0
|
|
for i,l in enumerate(sys.stdin.readlines()):
|
|
_, l = l[:-1].split(':')
|
|
tirages = l.split(';')
|
|
m_red = m_green = m_blue = 0
|
|
for tirage in tirages:
|
|
cubes = tirage.split(',')
|
|
for cube in cubes:
|
|
_, q, c = cube.split(' ')
|
|
q = int(q)
|
|
if c == 'red':
|
|
m_red = max(m_red, q)
|
|
if c == 'green':
|
|
m_green = max(m_green, q)
|
|
if c == 'blue':
|
|
m_blue = max(m_blue, q)
|
|
p = m_red * m_green* m_blue
|
|
R += p
|
|
print(R) |