Refactor 'word ladder' again.