Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Common Words by iwonieevo
def checkio(first, second):
joined_list = first.split(",")
joined_list.extend(second.split(","))
solution = []
for el in joined_list:
if joined_list.count(el) > 1 and el not in solution:
solution.append(el)
solution.sort()
return ",".join(solution)
if __name__ == '__main__':
print(checkio("hello,world", "hello,earth"))
assert checkio("hello,world", "hello,earth") == "hello", "Hello"
assert checkio("one,two,three", "four,five,six") == "", "Too different"
assert checkio("one,two,three", "four,five,one,two,six,three") == "one,three,two", "1 2 3"
Jan. 15, 2020