#C3336. Calculate Total Quantities for Items

    ID: 46752 Type: Default 1000ms 256MiB

Calculate Total Quantities for Items

Calculate Total Quantities for Items

Given a list of sales records where each record is in the format \(item,quantity\), compute the total quantities sold for each unique item. You are required to read from standard input and output the result to standard output. The final output should list each item and its total quantity in ascending lexicographical order of item names.

inputFormat

The first line contains a single integer \(n\) denoting the number of records. Each of the following \(n\) lines contains a record in the format \(item,quantity\), where \(item\) is a string and \(quantity\) is an integer.

outputFormat

For each unique item, output a line containing the item name and its total quantity separated by a space. The items should be printed in ascending lexicographical order.

## sample
1
apple,10
apple 10

</p>