Subtotal

Output the subtotal of the amount of each product.
Output by changing sequence in ascending order of name.

IN

apple 1200
orange 530
grape 740
orange 310
apple 860
grape 600
orange 250
apple 380

OUT

apple 2440
grape 1340
orange 1090

IN

grape -1000
orange 500
apple 700
banana 480
banana 640
apple 1200
grape 800

OUT

apple 1900
banana 1120
grape -200
orange 500

IN

grape 1500
apple 0
orange -200
grape -1500
orange 200
banana 300
banana -300

OUT

apple 0
banana 0
grape 0
orange 0


Leave a comment

Parsed as Markdown

Login to leave a comment