Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Lowercase or Uppercase

Limits: 2s, 512 MB

You are given a string S consisting of lowercase English letters (a, b, c ….. z), uppercase English letters (A, B, C … Z) and digits (0, 1, 2 …. 9). You are allowed to change any element in any position of S with lowercase or uppercase English letters.

Now you have to find minimum number of changes in string S so that string S contains only lowercase or contains only uppercase English letters.

Input

First line of input contains the number of test cases T (1<= T <= 100). Next T lines describe the case. Each case contains a string S (1 <= |s| <= 10000).

Output

For each test case, output a single line contains “Case X: Y” without any quote where X denotes the number of test cases and Y denotes the answer of the problem.

Samples

InputOutput
4
AAA
aaab
aaBa
aBaB
Case 1: 0
Case 2: 0
Case 3: 1
Case 4: 2

Author
Discussion
Submit

Login to submit