提示: 欢迎访问OurACM平台。
Problem 2011 Suneast’s blocks

Accept: 104    Submit: 387
Time Limit: 1000 mSec    Memory Limit : 32768 KB

Problem Description

Suneast loves playing with blocks so much. He has many small triangle blocks:

He always likes using these small block to make a bigger one:

The size of the small triangle is 1 and different block has different color, each color is expressed using an UPPER case alpha, so we can represent the big triangle above as the figure shows on the right.('~' means BLANK here)

Now, Suneast want to know, what is the size of the largest sub-strangle with the same color within the bigger one.

Input

The first line of the input data is an integer number T, represent the number of test cases.

The first line of each test case has an integer N (1<=n<=100), means the height of the big triangle. Then following N lines, each line has exactly 2*i-1 UPPER case letters represent the small triangle.

Output

For each test case, output a single line “Case %d: The largest block is %d.”, the first %d means the current case index, and the second %d is the size of the largest block.

Sample Input

3 3 A BCD EFDDD 4 A CCA CAAAC CACACAC 4 T ORZ DAXIA YAYAMAO

Sample Output

Case 1: The largest block is 4. Case 2: The largest block is 4. Case 3: The largest block is 1.

Source

FOJ有奖月赛-2011年03月

Submit  Back  Status  Discuss