improve solution for word ladder