fix a bug in the solution for Word Ladder