CODERE1 - Coder Express Le!!

Rahul was travelling to Amritapuri in Coder Express to participate in Programming Contest. On his way he met a girl named Meenamma. Meenamma was beautiful and also very good in programming skills. She was busy in solving a problem.

Rahul find this an oppurtunity to help her and impress her. He asked her about the question. The question was you have been given a string and you have to count the number of capital letters in the string which are preceded by a lowercase letter. Can you help Rahul to impress her?

Input

First line contains an integer T that represents the number of test cases.Then follows the T lines each containing string of no more than 1000 characters The string contains letters only and no special characters.

Output

For each test case, print only one line, the output of your program.

Example

Input:
2
MeeNaLocHn
ArgaSundaRam

Output:
3
2

Added by:Rajesh Kumar
Date:2013-09-01
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:AASF - ABV-IIITM PC-01-9-2013

hide comments
2018-07-14 06:13:17
"just next to small letters" -> "preceded by a lowercase char"
[Simes]: fixed

Last edit: 2023-03-19 18:03:40
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.