NAJCM - Count the miscall

no tags 

I have a friend named Dian. She is expert in giving miscall. When she starts giving miscall to any of her friends she doesn’t stop before 10 to 20 (sometimes more). We guess she has software for giving miscall. Otherwise how it is possible to give continuously as many miscall for a human being!

One day I decided to count how many miscall she can give at a time. But it’s really tough. Because sometimes I may have another phone call at the time of counting or I may receive her miscall thinking other’s call. After receiving any of her miscall I should start counting again since I want to count her maximum number of continuous miscall. But I shouldn’t do this after receiving other’s call or miscall. Could you help me in this job?

Input

First line of input contains the number of cases T (0 < T ≤ 100).

Each case contains a line consisting of four special character ‘.’, ‘*’, ‘#’ and ‘^’. Where ‘.’ denotes Dian’s miscall, ‘*’ denotes other’s miscall, ‘#’ denotes the received call of Dian and ‘^’ denotes the other’s receive call. Each line may contain at most 100000 characters.

Output

For each set of input, output a line containing case number followed by n where n is the maximum number of continuous miscall.

Sample

Input:
2
#...*...
...#...*...

Output:
Case 1: 6
Case 2: 6

hide comments
nadstratosfer: 2018-08-24 19:42:22

Don't print any blanklines else WA.

Jacob Plachta: 2014-10-26 04:38:56

Moved to Tutorial.


Added by:Najmuzzaman
Date:2014-10-25
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64