Solve problem "Elections in the USA" online - Learn Python 3 - Snakify

Problem «Elections in the USA» (Easy)


Statement

As you know, the president of USA is elected not by direct vote, but through a two-step voting. First elections are held in each state and determine the winner of elections in that state. Thereafter, the state election is going: in this election, every state has a certain the number of votes — the number of electors from that state. In practice, all the electors from the state of voted in accordance with the results of the vote within a state.

The first line contains the number of records. After that, each entry contains the name of the candidate and the number of votes they got in one of the states. Count the total results of the elections: sum the number of votes for each candidate. Print candidates in the alphabetical order.


In all the problems input the data using input() and print the result using print().



Saved solutions

Tests

Input Correct answer Result
5
McCain 10
McCain 5
Obama 9
Obama 8
McCain 1
McCain 16
Obama 17
13
McCain 10
McCain 3
Obama 19
Obama 2
McCain 7
McCain 2
Obama 6
Obama 10
McCain 11
McCain 5
Obama 3
Obama 12
McCain 13
McCain 51
Obama 52
1
Obama 1
Obama 1
7
ivan 2
gena 1
sergey 100000
ivan 1
ivan 1
ivan 0
gena 100
gena 101
ivan 4
sergey 100000
61
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
Obama 1
McCain 59
McCain 59
Obama 60