getting wrong answer

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.*;
class Hole
{

public static void main(String arg[])throws Exception

{
int count=0;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int p=Integer.parseInt(br.readLine());
if(p<=40)
for(int j=1;j<=p;j++){
String msg1=br.readLine();
String msg=msg1.toUpperCase();
int l=msg.length();
if(l<100)
for(int i=0;i<l;i++)
{
char c=msg.charAt(i);
if(c==‘A’||c==‘D’||c==‘O’||c==‘p’||c==‘R’||c==‘Q’)
count++;
if(c==‘B’)
count+=2;
}
System.out.println(count);
count=0;}

}
}