Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

FBH15R1B - Autocomplete

Since you crave state-of-the-art technology, you've just purchased a phone with a great new feature: autocomplete! Your phone's version of autocomplete has some pros and cons. On the one hand, it's very cautious. It only autocompletes a word when it knows exactly what you're trying to write. On the other hand, you have to teach it every word you want to use.

You have N distinct words that you'd like to send in a text message in order. Before sending each word, you add it to your phone's dictionary. Then, you write the smallest non-empty prefix of the word necessary for your phone to autocomplete the word. This prefix must either be the whole word, or a prefix which is not a prefix of any other word yet in the dictionary.

What's the minimum number of letters you must type to send all N words?

Input

Input begins with an integer T, the number of test cases. For each test case, there is first a line containing the integer N. Then, N lines follow, each containing a word to send in the order you wish to send them.

Output

For the ith test case, print a line containing "Case #i: " followed by the minimum number of characters you need to type in your text message.

Constraints

1 ≤ T ≤ 100
1 ≤ N ≤ 100,000

The N words will have a total length of no more than 1,000,000 characters.
The words are made up of only lower-case alphabetic characters.
The words are pairwise distinct.

NOTE: The input file is about 10-20MB.

Explanation of Sample

In the first test case, you will write "h", "he", "l", "hil", "hill", for a total of 1 + 2 + 1 + 3 + 4 = 11 characters.

Sample Input

5
5
hi
hello
lol
hills
hill
5
a
aa
aaa
aaaa
aaaaa
5
aaaaa
aaaa
aaa
aa
a
6
to
be
or
not
two
bee
3
having
fun
yet

Sample Output

Case #1: 11
Case #2: 15
Case #3: 11
Case #4: 9
Case #5: 3
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.

Added by:Tjandra Satria Gunawan
Date:2015-01-19
Time limit:60s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 JS-MONKEY SCM qobi
Resource:FBHC 15 Round 1

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.