• wrong answer

Question related to mission Common Words

 

I would like to give some feedback about this task, t think checking answers is wrong because it accepts only answers in some fixed order, and this order is not fixed by any of arguments.

From: http://www.checkio.org/mission/common-words/solve/

HTTP_USER_AGENT:

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36

My Code:

def checkio(first, second):
    first_set = set(first.split(","))
    s=""
    for x in second.split(","):
        if(x in first_set):
            if(len(s)>0):
                s+=","
            s += x

    return s

#These "asserts" using only for self-checking and not necessary for auto-testing
if __name__ == '__main__':
    assert checkio(u"hello,world", u"hello,earth") == "hello", "Hello"
    assert checkio(u"one,two,three", u"four,five,six") == "", "Too different"
    assert checkio(u"one,two,three", u"four,five,one,two,six,three") == "one,three,two", "1 2 3"