from os import WNOHANG


def clean(word: str):
    a = len(word)
    
    while True:
        word = word.strip("()[]{}!?.,<>:;-_`’‘")
        if a == len(word):
            break

        a = len(word)

    return word

def file_to_set(filename: str, clear: bool):
    dfio = open(filename, "r", encoding="cp1252")
    words = set()

    for line in dfio:
        for word in line.strip().split():
            if clear:
                word = clean(word)
                if word == "":
                    continue
            
            words.add(word.lower())
        
    dfio.close()
    
    return words


def main():
    dictionary = file_to_set("words.txt", False)
    document = file_to_set("ge.txt", True)
    misspelling = dictionary.difference(document)

    for word in sorted(misspelling):
        print(word)

main()