题解 | #公共子串计算#
公共子串计算
https://www.nowcoder.com/practice/98dc82c094e043ccb7e0570e5342dd1b
a = input().strip() b = input().strip() import sys just1 = False if a in b: print(len(a)) sys.exit() if b in a: print(len(b)) sys.exit() for i in range(min(len(a),len(b))-1,-1,-1): for j in range(len(a)-i): if a[j:j+i] in b: print(i) just1 = True break if just1: break