16 lines
381 B
Python
16 lines
381 B
Python
import sys
|
|
for line in sys.stdin:
|
|
p = line.split()
|
|
state = p[0].strip("[]")
|
|
costs = p[-1]
|
|
|
|
n = len(state)
|
|
state = int(state.replace("#","1").replace(".","0"), 2)
|
|
buttons = []
|
|
for x in p[1:-1]:
|
|
val = 0
|
|
for i in x.strip('()').split(','):
|
|
val |= 2**(n-int(i)-1)
|
|
buttons.append(val)
|
|
print(*map(hex, [state]+buttons))
|