Answer to Question #329407 in Python for Mamatha

Question #329407

For example if the given two strings A and B are "ramisgood" "goodforall"





The output should be "good"

1
Expert's answer
2022-04-16T06:47:42-0400
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS