fst = str(input("First string: "))
sec = str(input("Second string: "))
ans= ""
len1, len2 = len(fst), len(sec)
for i in range(len1):
overlap = ""
for j in range(len2):
if (i + j < len1 and fst[i + j] == sec[j]):
overlap += sec[j]
else:
if (len(overlap) > len(ans)):
ans = overlap
overlap = ""
print(ans)
Comments
Leave a comment