Holes in the text

hey can anyone find bug in this program?


program HOLES;

var
   t,x,y,f:longint;
   word:string;
begin
	
	read(t);
	
	for y := 1 to t do 
	begin
	
   
	read(word);
	f := 0;
	for x := 1 to length(word) do
	begin
	
	if word[x] in ['A','D','O','P','Q','R'] then inc(f)
	else if word[x] = 'B' then inc(f,2);
    
 	end;
	writeln(f);
	end;
end.

@vinay1729 Hi I don’t know much python that’s why I have changed some of your syntax …your logic is correct …I have modified your solution here is link…CodeChef: Practical coding for everyone hope u will get it…HAPPY CODING

The language he is using is pascal, not python so I assume he would prefer an explanation in pascal.
Back on point the logic is correct so the problem is in input. The formatting of the problem states that the string input is in a different row, hence the problem with pascal’s read(), roughly, is that it will read what it sees in one line, so your code, as i assume, will keep reading the first line and find nothing, hence will output 0. When there are more lines of input use readln().

Friends first of all this program is written in PASCAL FPC .
Your input method is wrong

here is your corrected code :-(have a look , i have just corrected the input method)

ideone link

Thanks friend but i am using Pascal FPC.