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