I\'m looking for the way of comparing two strings and being able to get back, as separate strings:
def find_common_characters(msg1,msg2):
l=[]
msg11=msg1.replace(" ", "")
msg22=msg2.replace(" ", "")
for letter in msg11:
if letter in msg22:
l.append(letter)
if len(l)!=0:
return "".join(l)
else:
return -1
msg1="I like Python"
msg2="Java is a very popular language"
common_characters=find_common_characters(msg1,msg2)
print(common_characters)