enter code here
using namespace std;
else if(str[j]=='O' || str[j]=='Q' || str[j]=='A' || str[j]=='P' || str[j]=='D' || str[j]=='R')
Please put proper indented code or paste the ideone link
Please if you ask a question, paste your code on ideone and include a link here.
About your error…
Bug 1: you have included return 0 inside while loop due to which your code work for only first test case.
Bug 2: You are not printing result in newline.
remove return 0 from while loop and add endl after cout<< count.
Here is your AC version code : http://www.codechef.com/viewsolution/6095567
Hope You understood…
i cant believe i made that return 0 mistake O.o thank you so much