Can someone please tell me what is wrong with this code. It always shows a wrong answer. Thanx in advance…Below is the code : -
#include <iostream>
#include <cstring>
using namespace std;
int main() {
int t,cnt;
string s;
const char * c;
while(t!=0)
{
scanf("%s",&s);
c=s.c_str();
cnt=0;
while((*c)!='\0')
{
if((*c)=='A'||(*c)=='D'||(*c)=='O'||(*c)=='P'||(*c)=='Q'||(*c)=='R')
cnt++;
if((*c)=='B')
cnt+=2;
*c++;
};
printf("%d\n",cnt);
t--;
};
return 0;
}