Solve the programming task below in a Python markdown code block.
Problem statement:

Kiran P.S wrote some text on a piece of paper and now he wants to know 
how many star characters are in the text. 
If you think of the paper as the plane and a letter as a curve on the plane, then each letter divides the plane into regions. For example letters "A", "D", "O", "P", "R" divide
 the plane into two regions so we say these letters each have one hole.
 Similarly, letter "B" has two holes and letters such as "C", "E", "F", "K"
 have no star character.  We say that the number of holes in the text is equal to the total number of holes in the letters of the text.. Help Kiran P.S. to 
determine what is the difference in number of holes in the upper and lower case
representation of a given string.

Input

The first line contains a single integer T ≤ 40, the number of test cases. T test cases follow.
The only line of each test case contains a non-empty text composed only 
of uppercase letters of English alphabet. The length of the text is less then 100.

Output

For each test case, output a single line containing the difference of holes each text case.

SAMPLE INPUT
2
HACKEREARTH
THENATIONALINSTITUTEOFENGINEERING

SAMPLE OUTPUT
0
-6