fork(3) download
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. using namespace std;
  5. int main()
  6. {
  7. int t,i,j,l;
  8. char a[100];
  9. scanf("%d\n",t);
  10. for(i=0;i<t;i++)
  11. {
  12. int count=0;
  13. gets(a);
  14. l=strlen(a);
  15.  
  16. for(j=0;j<=(l-1);j++)
  17. {
  18. if((a[j]=='A')||(a[j]=='D')||(a[j]=='O')||(a[j]=='P')||(a[j]=='Q')||(a[j]=='R'))
  19. {
  20. count=count+1;
  21. }
  22. if(a[j]=='B')
  23. {
  24. count=count+2;
  25. }
  26. }
  27. printf("%d",count);
  28. }
  29. return 0;
  30. }
Runtime error #stdin #stdout 0s 2684KB
stdin
1
RAHUL
stdout
Standard output is empty