2421. Opinion Poll

单点时限: 2.0 sec

内存限制: 256 MB

A research company ICPC (Inter City Popularity Corporation) takes a public opinion poll on the next prime minister at request by a TV station Maximum that wants to create a good TV program. The method of this public opinion poll is to ask to n person in town who is the best person for the next prime minister.

Your job is to write a program to sort a list of candidates in popular order.

输入格式

Input consists of multiple test cases. The first line of each test case contains a single positive integer n ( n <= 1,024). The following n lines contains an answer of a pollee. An answer consists of a name of the next prime minister or just “No”, it means there is no good person for the next prime minister. In other cases, a name is case insensitive and white spaces should be ignored. Input is terminated by a case of n = 0, and it should not be processed.

You can assume that answer consists of alphabet or white space. You can also assume that answer contains at least 1 alphabet and at most 64 letters.

输出格式

For each test case, you should output a test case number C starting from 1 in the format “Case #C”. In the next line, you should output the number of pollees n in the format “The number of pollees: n”. Let us consider m be the number of candidates for the next prime minister, you should output the name of candidate and the number of supporters in popular order. If there is two or more candidates with the same number of supporters, you should output the lexicographically smallest one at first. You should output the name of candidate in capital letter and remove all white spaces. You should output a blank line between two test cases.

样例

Input
10
ICHIRO
ICHIRO
JUNICHIRO
JUNICHIRO
JUNICHIRO
TARO
TARO
TARO
TARO
ROZEN
10
OZAWA
OZAWA
KOIZUMI
KOIZUMI
KOIZUMI
ASO
ASO
ASO
ASO
SHINKU
0
Output
Case #1
The number of pollees: 10
TARO 4
JUNICHIRO 3
ICHIRO 2
ROZEN 1
Case #2
The number of pollees: 10
ASO 4
KOIZUMI 3
OZAWA 2
SHINKU 1

0 人解决,7 人已尝试。

0 份提交通过,共有 16 份提交。

9.9 EMB 奖励。

创建: 16 年前.

修改: 7 年,2 月前.

最后提交: 3 月,4 周前.

来源: International Maximum-Cup 2008

题目标签