class Solution:
def shortestWay(self, source: str, target: str) -> int:
i = 0
j = 0
tmp = 0
count = 0
while j < len(target):
tmp = j
while i < len(source):
if j >= len(target):
break
if source[i] == target[j]:
i += 1
j += 1
else:
i += 1
if j == tmp:
return -1
count += 1
i = 0
return count