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
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments