#P16576. [GKS 2016 #A] Country Leader

    ID: 16549 Type: RemoteJudge 1000ms 1024MiB Tried: 0 Accepted: 0 Difficulty: 3 Uploaded By: Tags>2016排序Google Kick Start

[GKS 2016 #A] Country Leader

题目描述

The Constitution of a certain country states that the leader is the person with the name containing the greatest number of different alphabet letters. (The country uses the uppercase English alphabet from A through Z.) For example, the name GOOGLE has four different alphabet letters: E, G, L, and O. The name APAC CODE JAM has eight different letters. If the country only consists of these 22 persons, APAC CODE JAM would be the leader.

If there is a tie, the person whose name comes earliest in alphabetical order is the leader.

Given a list of names of the citizens of the country, can you determine who the leader is?

输入格式

The first line of the input gives the number of test cases, TT. TT test cases follow. Each test case starts with a line with an interger NN, the number of people in the country. Then NN lines follow. The ii-th line represents the name of the ii-th person. Each name contains at most 2020 characters and contains at least one alphabet letter.

输出格式

For each test case, output one line containing Case #x: y, where xx is the test case number (starting from 11) and yy is the name of the leader.

2
3
ADAM
BOB
JOHNSON
2
A AB C
DEF
Case #1: JOHNSON
Case #2: A AB C

提示

In sample case #11, JOHNSON contains 55 different alphabet letters ('H', 'J', 'N', 'O', 'S'), so he is the leader.

Sample case #22 would only appear in Large data set. The name DEF contains 33 different alphabet letters, the name A AB C also contains 33 different alphabet letters. A AB C comes alphabetically earlier so he is the leader.

Limits

1T1001 \leq T \leq 100.

1N1001 \leq N \leq 100.

Small dataset (Test set 1 - Visible)

Each name consists of at most 2020 characters and only consists of the uppercase English letters A through Z.

Large dataset (Test set 2 - Hidden)

Each name consists of at most 2020 characters and only consists of the uppercase English letters A through Z and ' '(space).

All names start and end with alphabet letters.