fork(1) download
  1. program HOLES;
  2.  
  3. var
  4. t,x,y,f:longint;
  5. word:string;
  6. begin
  7.  
  8. readln(t);
  9.  
  10. for y := 1 to t do
  11. begin
  12.  
  13.  
  14. readln(word);
  15. f := 0;
  16. for x := 1 to length(word) do
  17. begin
  18. if word[x] in ['A','D','O','P','Q','R'] then f+=1
  19. else if word[x] = 'B' then inc(f,2);
  20.  
  21. end;
  22. writeln(f);
  23. end;
  24. end.
Success #stdin #stdout 0s 232KB
stdin
2
CODECHEF
DRINKEATCODE
stdout
2
5