Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Common Words by quis20
import string
def checkio(first, second):
first_table = first.split(",")
second_table = second.split(",")
result = ""
for word in first_table:
for second_word in second_table:
if word == second_word:
if not word in result:
result = result + "," + word
data = result.split(",")
data = sorted(data)
final_str = ""
i = 0
for word in data:
if len(word) < 2:
continue
if i == 0:
final_str = word
i = 1
else:
final_str = final_str + "," + word
return final_str
#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,three,two", "1 2 3"
Jan. 24, 2016