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.

Sample

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

Submit

Login to submit.

Statistics

86% Solution Ratio
Sparrow36Earliest, Dec '17
suhail_mujtabirFastest, 0.0s
mdalaminislamLightest, 0 B
ShuddhoShortest, 152B
Toph uses cookies. By continuing you agree to our Cookie Policy.