Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p,q,e,f=[],[],'\n([{<',' )]}>'
- for h in open(0):
- x,s=[],0
- for c in h:
- if c in e:x+=[f[e.find(c)]]
- elif c!=x.pop():p+=[[0,3,57,1197,25137][f.find(c)]];x=0;break
- while x:s=s*5+f.find(x.pop())
- if s:q+=[s]
- print(sum(p),sorted(q)[len(q)//2])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement