题解 | #公共子串计算#
公共子串计算
https://www.nowcoder.com/practice/98dc82c094e043ccb7e0570e5342dd1b
n=input() m=input() max="" if len(n)>=len(m): for i in range(len(m)): for j in range(i,len(m)): if m[i:j+1] in n and len(m[i:j+1])>len(max): max=m[i:j+1] else: for i in range(len(n)): for j in range(i,len(n)): if n[i:j+1] in m and len(n[i:j+1])>len(max): max=n[i:j+1] if(len(max)!=0): print(len(max)) else: print(0)