HOLES ,GETTING WRONG ANSWER

#include<stdio.h>
#include<string.h>
int main()
{
int t,i,J,c;
char a[101],n=0;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%s",a);
c=strlen(a);
J=0;
n=0;
for(J=0;J<c;J++)
{
if(a[J]==‘A’||a[J]==‘D’||a[J]==‘O’||a[J]==‘P’||a[J]==‘Q’||a[J]==‘R’)
{
n=n+1;
}
else

		if(a[J]=='B')
	        {	
                     n=n+2;
            }	
     }

	printf("%d\n",n);}
	
		
//		getch();
		return 0;
	}

The only error in the solution is that you have taken the data type of variable n to be a Character. Change it to Integer and it would get accepted.

1 Like

thanks u very much