Олимпиадный тренинг

Задача 38784. Nishtyachki young programmers


Задача

Темы: Словари

PYTHON INFINITE TYPE?
At the summer programming training camp, for each solved problem, they were given a certain amount of fanfiction. During the shift, young programmers could spend these fanfictions on buying various goodies. At the end of the shift, the organizers accumulated a large list, each line of which is a record of the form Programmer good amount, where Programmer name of the young programmer (string without spaces), nice item - name of the purchased item (string without spaces), number< /tt> — number of purchased units nishtyachka. 

Output a generalized list, indicating the name of the young programmer and all the goodies that he acquired during the shift and their number.

Input
The program receives as input a set of strings in the format specified in the problem statement.

Imprint
Print a list of all buyers in lexicographical order, after the name of each buyer print, in parentheses, the total number of purchased goodies, then, after the colon, print a list of the names of all goodies purchased by the programmer in lexicographic order, after the name of each goody print the number of units of acquired goodies. Information about each niche is displayed on a separate line.
 
Examples
# Input Output
1
Ivanov paper 10
Petrov pens 5
Ivanov marker 3
Ivanov paper 7
Petrov envelope 20
Ivanov envelope 5
Ivanov:
envelope 5
marker 3
paper 17
Petrov:
envelope 20
pens 5