Try to solve the Word Ladder problem.

Statement

Given two words, src and dest, and a list, words, return the number of words in the shortest transformation sequence from src to dest. If no such sequence can be formed, return 00.

A transformation sequence is a sequence of words ((src →\to word1word_1 →\to word2word_2 →\to word3word_3 ...... →\to wordjword_j )) that has the following properties:

  • wordj=word_j = dest
  • Every pair of consecutive words differs by a single character.
  • All the words in the sequence are present in the words. The src does not need to be present in words.

Constraints:

  • 1≤1 \leq src.length ≤10\leq 10

  • src.length == dest.length == words[i].length

  • src ≠\neq dest

  • 1≤1 \leq words.length ≤5000\leq 5000

  • No duplicates in the words

  • src, dest, and words[i] consist of lowercase English characters.

Examples