https://pastebin.com/5386NdYz
Oh, no, I didn't mean to remove count++ from the first if.
I mean, the only thing that I think was wrong in the code that we discussed yesterday at night, that this additional count++ was bad. Everything else seem to be good. So the logic I proposed, only changes this behaviour (adding one to the result value). Other counting should remain the same.
Anyway, I don't want to help you with this task anymore, I'm pretty sure you can get to the solution yourself