题目:
代码:
class Solution:
def shortestWay(self, source: str, target: str) -> int:
#初始化的过程
s = []
t = []
for i in range(0,len(source)):
s.append(source[i])
for i in range(0,len(target)):
t.append(target[i])
temp = -1
flag = 0
if t[0] not in s:
return -1
num = 1
length = len(s)
for i in range(1,len(t)):
if t[i] not in s:
return -1
index = s.index(t[i-1])
if index < temp:
index = temp
for j in range(index+1,length):
i