Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Simple solution in Clear category for Common Words by PawlakBartosz43
def checkio(first, second):
list_first = first.split(",") #turn strings into actual lists of words
list_second = second.split(",")
list_result = [] #prepare an empty list for the result
comma = ','
for word1 in list_first: #check each word from the first list with each word from the second list
for word2 in list_second:
if(word1==word2):
list_result.append(word1) #if the words match - add that word to our result list
list_result.sort() #the result must be in an alphabetical order
return comma.join(list_result) #return the result as a string, words separated by commas
Dec. 10, 2016