Holes in the text

Unable to find the error in the program as it runs successfully and give desired result on linux terminal. But “WRONG ANSWER” is shown after submission.
please help !


int main()
int holes=0,a,k,t,i;
char arr[100];
if (t<=40)
for (i=0;i<t;i++)
a = strlen ( arr ); ///////
for (k=0;k<=a;k++)
if (arr[k]==‘B’)
holes = holes+2;

	else if ( arr[k]=='A' || arr[k]=='D' || arr[k]=='O' || arr[k]=='P' || arr[k]=='Q' || arr[k]=='R' )
	else continue;


return 0;



  1. you forgot initialize holes to 0 for every test case,

  2. you have to print output in new line for each test case,

Just do the above correction and you’ll get AC. :slight_smile:

Here is your updated code.

Two points you need to modify.

  1. Reset the count of holes, ( holes = 0 ) at each input string.
  2. Print the answer at a new line for each output.

put \n in printf. it will get accepted.