using namespace std;
if(front*==bob[j] || rear*==bob[j])
Your code will give wrong answer for test case such as
Here there is no ‘o’, still count will increase because you are using or operator.
Try to solve this question by counting each ‘b’ and ‘o’ individually.
You can also go for all possible cases as there are only 8 case.