Write a program to check the overlapping of one string's suffix with the prefix of another string.
a = str(input())
b = str(input())
answer = ""
len1, len2 = len(a), len(b)
for i in range(len1):
match = ""
for j in range(len2):
if (i + j < len1 and a[i + j] == b[j]):
match += b[j]
else:
if (len(match) > len(answer)):
answer = match
match = ""
print(answer)
Comments
Leave a comment