In the given prefix and suffix program, how to print no overlapping statement
N1 = input("Enter the first string:")
N2 = input("Enter the second string: ")
def overlapping(X1, X2):
output = ""
len1, len2 = len(X1), len(X2)
for i in range(len1):
match = ""
for n in range(len2):
if (i + n < len1 and X1[i + n] == X2[n]):
match += X2[n]
else:
if (len(match) > len(output)): output = match
match = ""
if output == '':
return 'No overlapping'
else:
return output
print(overlapping(N1, N2))
Comments
Leave a comment