Holes in Text Wrong Answer

I am using the below code to solve the HOLES in the TEXT problem, I am getting the expected o/p, but Its is not accepting the answer, I have checked the other solutions also they have the same logic as mine, But I don’t know why my solution is not being accepted.

Please help me out here

This is my code which i have used

#include<stdio.h>
int main(void)
{
	int test;
	scanf("%d",&test);
	while(test--)
	{   
		char str[100];
		int holes=0;
		scanf("%s",str);
		  int i;
		for(i=0;str[i]!='\0';++i)
                {
		                   if(str[i]=='A'||str[i]=='D'||str[i]=='O'||str[i]=='P'||str[i]=='R'||str[i]=='Q')
			    ++holes;
			if(str[i]=='B')
			   holes=holes+2;
		}
		printf("%d",holes);
	}
}

You need to print each output ( number of holes ) at a new line.

Change the line printf("%d",holes); to printf("%d\n",holes); and it will be accepted.

Check your accepted code with the above modification here.

Thanks, feeling embarrassed I should be more careful before posting.

Don’t worry, small points like these sometimes get overlooked.

We all make silly mistakes quite often, this makes us human.