问题4124--Arrangement of Contest

4124: Arrangement of Contest

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 128 MB

题目描述

Little Bob and little Jack want to arrange a contest. Their little friends submitted several task proposals and now Bob and Jack r want to select some of them for the contest. As they are just little boys, they cannot estimate quality of tasks, but they know for sure that in good contest title of the first problem starts with A, the title of the second one — with B, and so on.
Given titles of the proposed tasks, help little brothers to determine the maximal number of problems in a good contest they can arrange.

输入

The input begins with a line containing an integer T (1 <= T <= 30), the number of test cases. For each case,the first line contains single integer n— the number of problem proposals received by the little brothers (1 ≤ n ≤ 100).Next n lines contain titles of proposed problems, one per line. The length of each title does not exceed 30 characters. Each title starts with an uppercase letter and contains only English letters, digits and underscores.

输出

Output a single number — the maximal number of problems in a good contest. In case there is no good contest that may be arranged, output 0.

样例输入 Copy

3
12
ACM_ICPC
Boys and girls
Cherry_234234
Dog and Cat
Energetic_Boy
Fly_UFC
Grandfather
Happy birthday
Intersting contest
Jack and Dog
Kids in a Friendly Class
Lonely Mountain
3
Suoqi
An easy Problem
Another Problem
2
Good Problem
Better Problem

样例输出 Copy

12
1
0

来源/分类

Jiong King