题解 | #查找两个字符串a,b中的最长公共子串#
查找两个字符串a,b中的最长公共子串
https://www.nowcoder.com/practice/181a1a71c7574266ad07f9739f791506
s1 = input() s2 = input() res = [] maxlen = 0 if len(s1) > len(s2): s1,s2 = s2,s1 for i in range(len(s1)): for j in range(len(s1)-i): sub = s1[j:i+j] if sub in s2 and len(sub)>maxlen: maxlen = len(sub) res=sub print(res)
#华为机试#