fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. // your code goes here
  7. int a;
  8. char str[100];
  9. cin>>a;
  10. while (a--) {
  11. cin>>str;
  12. int x=0;
  13. for(int i=0; i<strlen(str); i++) {
  14. if (str[i]=='A') x=x+1;
  15. else if (str[i]=='D') x=x+1;
  16. else if (str[i]=='O') x=x+1;
  17. else if (str[i]=='P') x=x+1;
  18. else if (str[i]=='Q') x=x+1;
  19. else if (str[i]=='R') x=x+1;
  20. else if (str[i]=='B') x=x+2;
  21. else x=x+0;
  22. }
  23. cout<<x<<endl;
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 3344KB
stdin
2
CODECHEF
DRINKEATCODE
stdout
2
5