Given beginWord, endWord, and a wordList of equal-length words, return the number of words in the shortest transformation sequence from beginWord to endWord, changing exactly one letter at a time where each intermediate word must be in wordList (endWord must be in wordList). Return 0 if no sequence exists. The input is JSON {beginWord, endWord, wordList}.
Input: JSON {beginWord, endWord, wordList}.
Output: Integer — the sequence length, or 0.
Input: {"beginWord":"hit","endWord":"cog","wordList":["hot","dot","dog","lot","log","cog"]}
Output: 5
Explanation: hit->hot->dot->dog->cog.Input: {"beginWord":"hit","endWord":"cog","wordList":["hot","dot","dog","lot","log"]}
Output: 0
Explanation: endWord not in list.Input: {"beginWord":"a","endWord":"c","wordList":["a","b","c"]}
Output: 2
Explanation: a->c directly.1<=words<=5000words share equal length lowercase