1F - Approximate Pattern Matching Problem

I got one wrong answer with exactly the same code I got my right answer.
I have no clue why.