What's wrong with this
First off, I don't think this is the appropriate place for this question.

Second; why are you incrementing count2 by 2 each time you find a "name" field that begins with a B? Surely this should be incremented by 1, like count 1 is.

Out of interest, do you know what the correct results should be?

Could you post them?