PROBLEM 2: League Standings


Description:

You have been hired to computerize Creighton's intramural basketball records. Each team in the intramural league has a unique name and plays some number of games against other teams in the league (possibly playing the same team more than once). You are to take the scores of all the games played and create the standings for the league, displaying the win-loss records for the teams and ordering them based on the number of wins.

Input:

The input will consist of some number of lines of text of the form

NameH ScoreH NameV ScoreV
where NameH is the name of the home team, ScoreH is the home team's score, NameV is the name of the visiting team, and ScoreV is the visiting team's score. You may assume that there are no ties, so one of the scores will be larger and signify the winner of that game. The last line of input will have negative numbers for each of the scores.

Example Input:

Jays 85 Dogs 80
Cats 65 Dogs 70
Squirrels 77 Jays 78
Cats 80 Squirrels 55
? -1 ? -1

Output:

For each team listed in the scores, you should output a line containing the team name followed by their win-loss record. There should be one space between the team name and the number of wins, and a single hyphen between the number of wins and losses. Teams should be listed in order based on wins. That is, the team with the most wins should be listed first and the team with the fewest wins last. Among teams with the same number of wins, they should be listed in alphabetical order by team name. The output should terminate with the word "DONE" on a line by itself.

Example Output:

Jays 2-0
Cats 1-1
Dogs 1-1
Squirrels 0-2
DONE