Python3 代码
s, s1, s2 = input().split(",")
if len(s) < len(s1) or len(s) < len(s2):
print (-1)
else:
l = -1
for i in range (len(s) - len (s1) + 1):
if s[i: i + len(s1)] == s1:
l = i + len(s1)
break
r = -1
for j in range (len(s), len(s2) - 1, -1):
if s[j - len(s2): j] == s2:
r = j - len(s2)
break
if l > -1 and r > -1 and l <= r:
print (r - l)
else:
print (-1)