Here is my code. Please help with the error.
import java.io.*;
public class Main
{
public static void main(String args[])throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
for(int j=1;j<=t;j++)
{
String st=br.readLine();
int i,count=0;
for(i=0;i<st.length();i++)
{
if((st.charAt(i)=='A')||(st.charAt(i)=='D')||(st.charAt(i)=='O')||(st.charAt(i)=='P')||(st.charAt(i)=='R'))
{count=count+1;}
if(st.charAt(i)=='B')
{count=count+2;}
}
System.out.println(count);
}
}
}