My group has money troubles X50796


Statement
 

pdf   zip

html

Input The input starts with the amount of lines that come afterwards. These lines include two names (each of them starting with upper case) that indicate who pays (the first one) and whom (the second one), the third value is the money lent.

Output The balance of each person, ordered from who receives the most to who pays the most. In case two people have the same final balance, use alphabetical order.

Public test cases
  • Input

    4
    Mary John 2000
    John James 3000
    Anna Mary 1000
    James Anna 300
    

    Output

    John receives 1000
    Mary receives 1000
    Anna receives 700
    James pays 2700
    
  • Information
    Author
    HP CodeWars
    Language
    English
    Official solutions
    Python
    User solutions
    C++ Python