题解 | #公共子串计算#
公共子串计算
http://www.nowcoder.com/practice/98dc82c094e043ccb7e0570e5342dd1b
while True:
try:
s1 = input()
s2 = input()
except:
break
else:
num=0
if(len(s2)<len(s1)):
s1,s2=s2,s1
for i in range(len(s1)):
for j in range(1,len(s1)+1):
sub_s1=s1[i:j]
if sub_s1 in s2 and (j-i)>num:
num=j-i
print(num)