you can combine these two lines.
words.add(word.strip())