Given with two words(say cat & dog) we need to come up with the shortest path from cat to dog.