https://programmers.co.kr/learn/courses/30/lessons/60057
from collections import deque
from difflib import SequenceMatcher
def solution(begin, target, words):
answer = 0
queue= deque()
n = len(words)
nn=len(words[0])
if target not in words:
return answer
else:
queue.append([begin,0])
#print(begin)
while queue:
temp,answer = queue.popleft()
answer +=1
if temp == target:
return answer-1
for i in range(n):
ratio=SequenceMatcher(None, temp, words[i]).ratio()
if ratio == (nn-1)/nn:
queue.append([words[i],answer])
print(words[i])
print(answer)
return answer-1
return answer