Balances

Given a sequence of triplets formed by two names x and y and a natural
n, that indicate that x has paid n euros to y, print the final balance
of each person, first sorted by name, and then sorted by balance.

Input

Input is a non empty sequence of triplets formed each one by two names
and a natural. There are not two people with the same name.

Output

Your program must print the final balance of each person, first sorted
by name, and then sorted by balance, separated by a line with twenty
dashes. In the event of a tie in the balance, it must print first the
smallest name.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:17:40.398Z

© Jutge.org, 2006–2026.
https://jutge.org
