Holes in the textProblem code: HOLES |
All submissions for this problem are available.
Chef wrote some text on a piece of paper and now he wants to know how many holes are in the text. What is a hole? 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 holes. 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 Chef to determine how many holes are in the text.
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. There are no any spaces in the input.
Output
For each test case, output a single line containing the number of holes in the corresponding text.
Example
Input: 2 CODECHEF DRINKEATCODE Output: 2 5
| Author: | anton_lunyov |
| Date Added: | 13-01-2011 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

Has letter "Q" a whole?
Has letter "Q" a whole?
I think......codechef should
I think......codechef should have mentioned about Q....
Read the problem statement
Read the problem statement carefully. Look at the phrase "For example".
should we check for the error
should we check for the error conditions like if (T > 40) return -1; or something, my code is not accepted.
It is guaranteed that T<=40.
It is guaranteed that T<=40.
What consists of "text"? Even
What consists of "text"? Even lowercase characters, digits, etc. are included?
Sorry, my bad. Just noticed
Sorry, my bad. Just noticed that only uppercase letters are included.
LOL program :-P
LOL program :-P
plz tell me somebody.I m new
plz tell me somebody.I m new to codechef.
if this problem has been moved to prcatice section, then y there is no option for submission of code.
I want to check my code for this programme whether it is satisfying the all the constraints or not.
@km_rama it will be there in