题解 | #公共子串计算#
公共子串计算
https://www.nowcoder.com/practice/98dc82c094e043ccb7e0570e5342dd1b
s1 = input().lower() s2 = input().lower() if len(s1) > len(s2): s1,s2 = s2,s1 p = 0 for i in range(0,len(s1)): for j in range(i,len(s1)): if s1[i:j+1] in s2 and j+1-i > p: p = j+1-i print(p)