fork download
  1.  
  2. #include<iostream>
  3. #include<stdio.h>
  4. using namespace std;
  5.  
  6. char b[100]; using namespace std;
  7.  
  8. int main()
  9.  
  10. { int a,t=0,c[40],s; cin>>a;
  11.  
  12. do { s=0; scanf("%s",b);;
  13.  
  14. for(int i=0;b[i]!='\0';i++) { if(b[i]=='A'||b[i]=='D'||b[i]=='O'||b[i]=='P'||b
  15.  
  16. [i]=='R'||b[i]=='Q') s+=1; if(b[i]=='B') s+=2; }
  17.  
  18. c[t]=s; t++; }while(t<a);
  19.  
  20. for(int J=0;J<a;J++) cout<<c[J]<<endl;
  21.  
  22. return(0);
  23.  
  24. }
  25.  
Success #stdin #stdout 0s 3344KB
stdin
2
CODECHEF
DRINKEATCODE
stdout
2
5