fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. int main (void)
  4. {
  5. int x, y, z, a;
  6. char c[100];
  7. scanf ("%d", &x);
  8. for (x; x > 0; --x)
  9. {
  10. scanf ("%s", &c);
  11. a = 0;
  12. for (z = 0; c[z] != '0'; ++z)
  13. {
  14. if(c[z]=='A'|| c[z]=='D'|| c[z]=='O'|| c[z]=='P'|| c[z]=='Q'|| c[z]=='R')
  15. {
  16. ++a;
  17. }
  18. if (c[z] == 'B')
  19. {
  20. a = a + 2;
  21. }
  22. }
  23. printf ("%d\n", a);
  24. }
  25. return 0;
  26. }
Success #stdin #stdout 0s 2292KB
stdin
Standard input is empty
stdout
Standard output is empty