#K53572. Total Sales Calculation
Total Sales Calculation
Total Sales Calculation
Given a series of transactions, each containing an item name and the quantity sold, calculate the total sales for each unique item. The result should list the items in alphabetical order along with their aggregated sales.
The input begins with an integer \( n \) representing the number of transactions. The following \( n \) lines each contain an item name (a string without spaces) and an integer quantity, separated by a space.
The output should have one line per unique item showing the item name and the total quantity sold, separated by a space. Items must be listed in alphabetical order.
Example:
Input: 6 orange 7 apple 4 banana 3 apple 2 banana 1 apple 5</p>Output: apple 11 banana 4 orange 7
inputFormat
The first line contains an integer \( n \) \( (0 \le n \le 10^5) \) which denotes the number of transactions. Each of the following \( n \) lines contains a string and an integer separated by a space, representing the item name and the quantity sold respectively.
outputFormat
For each unique item, output a line with the item name and the total quantity sold. The items should be printed in alphabetical order. If there are no transactions, do not print anything.
## sample1
apple 4
apple 4
</p>