Refactored words_match? method to pattern match when the word and candidate are the same