this code runs well for given test case ....but gives runtime error.Please help
#include<stdio.h>
int main()
{
char b[20];
int i=0,c=0,t=0;
scanf("%d",&t);
while(t--)
{
c=0;
i=0;
scanf("%s",b);
while (b[i]!='\0')
{
if (b[i]=='A'||b[i]=='D'||b[i]=='O'||b[i]=='P'||b[i]=='R')
{
c++;
}
else if(b[i]=='B')
{
c+=2;
}
i++;
}
printf("%d",c);
}
return 0;
}