fork(3) download
  1. #include<iostream>
  2. #include<string>
  3. #include<cstdio>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int t = 0;
  10. scanf("%d", &t);
  11.  
  12. int holes[26] = {1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0};
  13. char text[99];
  14. for(int i=0; i<t; i++) //test cases loop
  15. {
  16. scanf("%s", text);
  17. int count = 0;
  18.  
  19. for(int i=0; i<99; i++)
  20. {
  21. int x = (int)text[i];
  22.  
  23. if(x==0)
  24. {
  25. break;
  26. }
  27. else if(x>=65 && x<=90)
  28. {
  29. count = (count + holes[x-65]);
  30. }
  31. }
  32.  
  33. printf("%d", count);
  34.  
  35. if(i!=(t-1))
  36. {
  37. printf("\n");
  38. }
  39. }
  40.  
  41. return 0;
  42. }
Success #stdin #stdout 0s 3100KB
stdin
3
ADOPR
HELLO
HEYYYYYYYYY
stdout
5
1
0