Hole in text not working

//I have a code below which when I submit shows NZEC by the online judge. Can anyone please help me in finding the problem

import java.io.*;

 class Holes{
public static void main(String args[]) throws Exception{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	String array[] = br.readLine().split(" ");
	int tc = Integer.parseInt(array[0]);
	int td = Integer.parseInt(array[1]);
	String str[] = new String[tc];
	for(int i=0;i<tc;i++){
		str[i] = br.readLine().toUpperCase();
	for(int i=0;i<str.length;i++){
		int x = count(str[i]);

public static int count(String str){
	int cnt = 0;
	for(int i=0;i<str.length();i++){
		if(str.charAt(i) == 'A' || str.charAt(i) == 'D' || str.charAt(i) == 'O' || str.charAt(i) == 'P' || str.charAt(i) == 'R'){
		if(str.charAt(i) == 'B'){
	return cnt;


There is only one integer in first line. You can remove the statement int td = Integer.parseInt(array[1]);

And do not forget Q :slight_smile:

1 Like

Still it’s not working

Do you find a hole in Q?

1 Like

Thanks a lot @vinayawsm it worked :).

1 Like