Logo
(追記) (追記ここまで)

13772번 - Holes 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB37930227778.693%

문제

Mike 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 in this context?

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" and "O" 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" and "K" have no holes. Spaces, of course, 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 Mike to determine how many holes are in the text.

입력

Input starts with an integer, N, on a line of its own (0 < N <= 30). It tells you how many lines of text follow. There then follow N lines of text. Each line contains a string of text composed only of upper case letters and spaces; it will contain at least 1 letter. The length of the text is no more than 250 characters.

출력

For each line of input, output a single line containing the number of holes in the corresponding text.

제한

예제 입력 1

3
CHEAT CODE
HAVE A CUP OF TEA
NEW ZEALAND

예제 출력 1

3
5
3

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > New Zealand Programming Contest > NZPC 2016 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /