Back to task

158 symbols python3
Fri Aug 8 22:25:59 2014 z423x5c6
import sys
a={}
for i in sys.stdin:
 i=i.strip('\n').split()
 if i[0]in a:a[i[0]]+=int(i[1])
 else:a[i[0]]=int(i[1])
for k in sorted(a.keys()):
 print(k,a[k])


Leave a comment

Parsed as Markdown

Login to leave a comment