Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Common Words solution in Clear category for Common Words by graffme
def checkio(first, second):
firstList = first.split(",")
secondList = second.split(",")
commonWords = []
for word in secondList:
if word in firstList:
commonWords.append(word)
commonWords.sort();
result = ",".join(commonWords)
return result
#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
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, two,three", "1 2 3"
Jan. 11, 2017