题解 | #查找两个字符串a,b中的最长公共子串#
查找两个字符串a,b中的最长公共子串
http://www.nowcoder.com/practice/181a1a71c7574266ad07f9739f791506
while True:
try:
s1 = input()
s2 = input()
if len(s1) > len(s2):
s1,s2 = s2,s1
res = []
opt = ''
for i in range(len(s1)):
for j in range(i+1,len(s1)+1):
if s1[i:j] in s2:
res.append(s1[i:j])
for i in res:
if len(i) > len(opt):
opt = i
print(opt)
except:
break