words=["catdog","godtac","apple","catdogg","python","hello","dogcat","cat","dog","cat_and_dog"]
for word in words:
    target=["c","a","t","d","o","g"]
    wordlist=list(word)
    for i in wordlist:
        for j in target:
            if i==j:
                target.remove(j)
                break
    if((len(target)==0) and (len(wordlist)==6)):
        print(word)
#运行结果:catdog
godtac
dogcat