This is really strange, but it has to have something to do with the spacing. It's giving you the right-most x when there are two consecutive x's and then a space. So, x-x-blank-x is second, but x-blank-x-x is fourth. I added a fifth row to check and it's doing the same thing, but on the third consecutive x. So, x-x-blank-x-x is correctly giving me fifth, but x-x-x-blank-x is giving me third. It stops looking once it hits that space.