| CodeRams Practice Problem Archive |
|---|
| Finished |
You're attending an international Zoom call during the Coronavirus quarantine, where the attendees represent many different countries. The zoom call is really long, and to pass the time, you tally how many people are from each country.
Given the list of people and their countries, print the countries, and how many meeting attendees are from each country. Sort the countries first by their number of attendees, and if two countries have an equal number of attendees, sort them alphabetically by the name of the country.
The first line of input contains a single positive integer $$$n$$$: the number of meeting attendees.
The next $$$n$$$ lines each contain a single country name $$$c$$$.
If there are less than five lines of input, output $$$n$$$ lines: each country, and it's number of meeting attendees, separated by a space.
Otherwise, output 5 lines: each of the top 5 countries using the sorting method described above, and it's number of meeting attendees, separated by a space.
11 USA Sweden Argentina Cameroon Egypt Australia England France Russia Mongolia India
Argentina 1 Australia 1 Cameroon 1 Egypt 1 England 1
4 USA USA Mexico Mexico
Mexico 2 USA 2
9 USA Germany Brazil China USA China China USA USA
USA 4 China 3 Brazil 1 Germany 1
| Name |
|---|


