Medium
Merge Sales
Two shops report sales as lines of
item amount. Read n and n lines for shop 1, then m and m lines for shop 2. Print the combined total for each item in alphabetical order as item amount.Input
Shop 1 then shop 2.
Output
One line per item.
Sample 1
Input
2 tea 5 rice 2 2 tea 3 salt 1
Output
rice 2 salt 1 tea 8
Sample 2
Input
1 a 1 1 a 1
Output
a 2
Output appears here