Hangman

Write a program that simulates the hangman game.

Remember that the hangman is a game of paper and pencil between two
players, for instance Anna and Bernat. Ana thinks a word and writes so
many asterisks as letters the word has. Bernat has to attempt to guess
which word is, proposing letters successively. If the letter that
proposes is in the word, Anna shows the positions where it is. If the
letter is not there, Anna “hangs” Bernat. Hanging him does not mean to
hurt him, but to create a doll that represents a hangman in a gallows.
The game ends with the victory of Bernat if he guesses all letters, or
with the victory of Anna if she manages to paint all the parts of the
doll (three in our case: head, arms and legs).

Input

Input starts with the word that Anna has chosen. This word only contains
six uppercase letters. Then, are coming the letters that Bernat
proposes.

Output

The output contains different blocks. The first block contains the
drawing of the gallows and shows six asterisks that represent the six
letters of the word that Bernat has to guess. Then, for each letter that
Bernat proposes, a block with the drawing of the gallows and the hangman
and the letter of the word that has guessed so far (printing asterisks
for the letters that has not already guessed) must be printed. The
program must stop writing blocks when a player wins and must print
“ END” (with a space before)

Use the examples to see the format of the gallows, the hangman and
blocks described previously.

Observation

Watch the case where the second player repeats one of the letters that
he has already proposed.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:15:14.829Z

© Jutge.org, 2006–2026.
https://jutge.org
