시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB27017915165.652%

문제

Han Solo wants a count of all the enemy fighters he shot down while captain of the Millennium Falcon. The data log has a list of kills but not the totals. You job is to write a program that will read the data log and display the name of the fighter followed by the number shot down and the total number of kills.

입력

Each line of input will contain the name of the fighter that was shot down. The end of input is marked with a 0 on the last line.

출력

The name of the fighter followed immediately by a colon followed by the number shot down. There should be one blank between the colon and the number shot down. The last line of output will be the word “Grand Total” followed immediately by a colon and the grand total of all fighters shot down. There should be one blank between the colon and the grand total. The fighters should be listed in order of first occurrence.

예제 입력 1

Tie-fighter
V-wing
Starfighter
Starfighter
Tie-fighter
Tri-fighter
V-wing
Starfighter
Tie-fighter
V-wing
Tri-fighter
V-wing
Starfighter
Tie-fighter
0

예제 출력 1

Tie-fighter: 4
V-wing: 4
Starfighter: 4
Tri-fighter: 2
Grand Total: 14