So I am making this Hangman program but the twist is that it doesn't actually pick a
word until it has to. The way that this is accomplished is that you start off with a list of words (a dictionary.txt file is what I use, it has a ton of words in it), how many guesses you want and the word size. Then, you give the program a letter to guess. After you give it a letter, what is supposed to happen is that it creates different "word families", based on that letters location in it. Let's say that I guess "a" for a four letter word- there would be a family of "----", a family of "--a-", a family of "-a--", etc. I want to use these strings as keys ("----", "--a-", etc) and have the words that match them be the values in a map.
My problem is that I can't figure out how to do this. If I said I wanted four letters, then every four letter word in the dictionary would go into a set. I want to be able to create different word families after the user guesses, then pick the one with the largest amount of words in it (thus how you can cheat the user), but I can't figure out how to do this. Sets don't have a get method, so I'm not really sure how I am supposed to check each character of each word to see if it matches with the guess. How would I do this? Am I supposed to use an iterator, and if I am how so?