For example if the given two strings A and B are "ramisgood" "goodforall"
The output should be "good"
s1 = input()
s2 = input()
if len(s1) > len(s2):
l = len(s2)
else:
l = len(s1)
for i in range(l,0,-1):
if s2[:i] == s1[len(s1)-i:]:
print(s2[:i])
break
Comments
Leave a comment