一、题目
二、示例
三、代码
while True:
try:
s1 = input()
s2 = input()
maxlength = 0
for i in range(len(s1)):
for j in range(i, len(s1)):
if s1[i:j+1] in s2 and len(s1[i:j+1]) > maxlength:
maxlength = len(s1[i:j+1])
print(maxlength)
except:
break
四、算法说明
无需啰嗦,暴力破解。
胡萝卜
2022年3月4日14:47:31
我不知道将去向何方,但我已在路上! |
---|
时光匆匆,虽未曾谋面,却相遇于斯,实在是莫大的缘分,感谢您的到访 ! |