I\'m reading in items:
for line in sys.stdin:
line = line.strip()
data = line.split(\"-\")
If I print data
as it is read,
Initialize a defaultdict
with type int and use the name as the key
from collections import defaultdict
name_list = defaultdict(int)
for line in sys.stdin:
line = line.strip()
data = line.split("-")
name = data[0]
value = int(data[1])
name_list[name] += value
for key, value in name_list.items(): print key, value