You are viewing a single comment's thread. Return to all comments →
from collections import OrderedDict n, item_list = int(input()), OrderedDict() for _ in range(n): item, price = input().rsplit(' ',1) item_list.setdefault(item, 0) item_list[item] += int(price) [print(i, v) for i, v in item_list.items()]
Collections.OrderedDict()
You are viewing a single comment's thread. Return to all comments →