# Word ladder problem for words with different length

Is there some one who know any algorithm for word ladder problem with words of different length?

Actually we have some strings with same length and some strings with one length longer but not from any size(any size means: one string with size 10 and one string with size 1000).

my solution is this: build a graph with strings in the nodes and nodes are connected if their strings can be converted to each other just by changing one letter, then using BFS.

The BFS algorithm still works with some changes. You'd basically have to pad an extra character in all the places. For instance, if there's no word of the same length to move from the word "hot", you check for words of length 4 characters. For this, you'd have to check all 26 characters in 4 positions. [x]hot, h[x]ot, ho[x]t, hot[x]
Check for the presence of the words from these transformations and add them to your queue. You'd basically have to do this for all lengths between beginWord.length and endWord.length