PROBLEM LINK :- CodeChef: Practical coding for everyone
MY SUBMISSION:- CodeChef: Practical coding for everyone
I tried multiple times using sample test cases. Everything looks fine but it’s still giving WA after submitting . Can anyone please point out the test case, due to which it’s throwing a WA?
Thank you 
if(s[Qi]==s[Qi+1])
dist--;
else if(s[Qi]!=s[Qi+1])
dist++;
if(s[Qi]==s[Qi-1])
dist--;
else if(s[Qi]!=s[Qi-1])
dist++;
This part of your code is contributing in the wrong answer.
if(s[Qi]==s[Qi-1])
dist--;
else if(s[Qi]!=s[Qi-1])
dist++;
Check again, the above part of code is bypassed since one of the former two conditions must be true.
1 Like
Even if I do this i.e using if instead of else if its giving WA…
You can see that code here CodeChef: Practical coding for everyone

yeah!! I think thats the issue… Thanks 