Hole in the Text (JAVA code)

Hi, my code is running fine on eclipse at my end but somehow the codechef says it’s wrong answer.
Please help.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class HoleinText {


public static void main(String[] args) throws IOException {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	int t= Integer.parseInt(br.readLine());
	String text = new String();
	int[] count = new int[t];
	for(int x=0; x<t;x++)
	{
		text=br.readLine();
		count[x] = 0;
		for(int y=0;y<text.length();y++)
		{
			if( text.charAt(y)== 'A' ||text.charAt(y)== 'D' ||text.charAt(y)== 'O' || text.charAt(y)=='P' ||text.charAt(y)== 'R')
			{
				
				count[x]++;
			}else if(text.charAt(y)== 'B' )
			{
				count[x] =count[x]+ 2;
			}
		}
	}
	for(int x=0;x<t;x++)
	{
		System.out.println(count[x]);
	}
	

}
}

You are missing a case of ‘Q’ since, it also contains one zero in it.

1 Like

oh, man… thanks a lot. :stuck_out_tongue:

Mark it as correct if it helps you.

1 Like