def checkio(line1: str, line2: str) -> str:
result = ''
for word in line1.split(','):
if word in line2:
result += word + ','
result = ','.join(sorted(result.split(',')))
return result[1:]
if __name__ == "__main__":
print("Example:")
print(checkio("mega,cloud,two,website,final", "window,penguin,literature,network,fun,cloud,final,sausage"))
Maybe a stupid question, but after a cycle of comparing two strings, "two" appears in the result variable, although it is not in the 2nd list