New course! Every coder should learn Generative AI!
Try a free lesson0
That's quite simple.
I cannot give you the code because I haven't read the "string" chapter yet.
But this is the method I thought:
2 strings A,B, one for the inserted word and one for the result one.
CIN the A string
WHILE loop with a BOOL X=0 condition
(
X=1
CIN a C CHAR
I=0
WHILE the ([I] char of string A) != '\n'
(
IF this characters = C, then write it to the ([I] position of string B) and substitute it on string A with a symbol (for example #)
ELSE IF it's != '#', then X=0
I++
)
Print string B
)
Then you can add messages, a counter for tentatives, etc...
If you don't understand something, please tell me.