Pregunta de entrevista de Goodnotes

A string manipulation problem and generate random word under certain rules