#C3613. Summarize Pastry Inventory
Summarize Pastry Inventory
Summarize Pastry Inventory
You are given a list of inventory records for various pastries. Each record contains a pastry name and a non-negative quantity. Your task is to compute the total quantity for each pastry type, and then output only those pastries whose total quantity is greater than zero. The output must be sorted alphabetically by the pastry name.
The input begins with an integer N representing the number of records. This is followed by N lines each containing a pastry name and a quantity (separated by a space).
Note: If all pastries have a total quantity of 0, output nothing.
inputFormat
The input is read from standard input (stdin). The first line contains a single integer N, the number of inventory records. Each of the next N lines contains a pastry name (a string without spaces) and a non-negative integer quantity, separated by a space.
outputFormat
Output to standard output (stdout) each pastry with a positive total quantity on a separate line. Each line should contain the pastry name and its total quantity separated by a space, sorted alphabetically by the pastry name. If no pastry has a positive total quantity, output nothing.## sample
7
Croissant 10
Donut 5
Eclair 0
Muffin 7
Croissant 3
Donut 8
Muffin 0
Croissant 13
Donut 13
Muffin 7
</p>