HOLES-why my code is showing wrong answer?

#include
#include
#include<stdio.h>
using namespace std;
int main()
{
int i,count,n,j;
string a;
scanf("%d",&n);
for(j=0;j<n;j++)
{ count=0;
cin>>a;
for(i=0;a[i]!=’\0’;i++)
{
if( a[i]==‘A’ || a[i]==‘D’ || a[i]==‘O’ || a[i]==‘P’ || a[i]==‘R’)
count++;
if(a[i]==‘B’)
count=count+2;
}
printf("%d\n",count);
}
return 0;

}

What about Q ?

1 Like

oh yes! got my mistake… thanks

#include
#include
using namespace std;
int main()
{
int count=0;
char st[100];
//scanf("%s",st);
cin>>st;
int l = strlen(st);
for(int i=0; i<l; i++)
{
if(st[i] == ‘A’||st[i] == ‘D’||st[i] == ‘P’||st[i] == ‘O’||st[i] == ‘Q’||st[i] == ‘R’)
count+=1;
if(st[i] == ‘B’)
count += 2;
}
// printf("%d Holes\n",count);
cout<<count;
return 0;
}

I think i got the answer…check in it

//