The following code runs well in codeblocks but here its showing error(runtime):
#include
#include <string.h>
using namespace std;
int main()
{
int i,j,k,c=0; int v[100];
char str[100];
cin>>i;
for(j=0;j<=i-1;j++)
{
cin>>str;
for(k=0;k<=strlen(str);k++)
{
char t=str[k];
if ((t=='A')||(t=='D')||(t=='O')||(t=='P')||(t=='Q')||(t=='R'))
c++;
if(t=='B')
c+=2;
}
v[j]=c;
c=0;
}
for(j=0;j<=i-1;j++)
cout<<v[j]<<"\n";
return 0;
}