短的字符串切片,查找该切片是否存在于长的字符串中:
while True:
try:
s1 = input()
s2 = input()
if len(s1) > len(s2):
s1, s2 = s2, s1
lst = [0]
for i in range(len(s1)):
for j in range(i + 1, len(s1) + 1):
if s2.count(s1[i:j]) >= 1:
lst.append(j - i)
print(max(lst))
except:
break