Guessing script

I want to make a guessing game for a friend’s school work but i am having trouble with a AI script, to guess the player’s word.

It’s the following:

The player types any word he can imagine, example: “Snake”. Then, the AI will try to guess the player’s word. For a test scene, i want to make a AI that simply combine keys and numbers until it guess the player’s word. Don’t worry, i already made a system that the player will not be able to write some things. But how can i do it? Is there a tutorial or something??

Just to clarify, are you saying that the AI will create a random string of characters, compare to the actual word for accuracy and then guess again based on the percentage of correct characters?