ans to store the answer.wordset and add all words from the words array to it.words array.ans or equal in length but lexicographically smaller.wordset.ans with the current word.ans as the longest word that can be built one character at a time.