Hangman
Statement
Goal
Given a word and a list of guesses, print out the hangman and Won if it was solved in time or Lost if the game was lost.Input
First Line: word for the puzzle
Second Line: Number of guesses taken n
Next n Lines: Single valid character guess
Second Line: Number of guesses taken n
Next n Lines: Single valid character guess
Output
3 Lines: A 3x3 partial or full hangman (including spaces)
Possible Outputs in order (HINT: Just copy-paste if needed):
4th Line: Won or Lost depending on game result
Possible Outputs in order (HINT: Just copy-paste if needed):
0 0 0 0 0 0
| /| /|\/|\/|\
/ / \
4th Line: Won or Lost depending on game result
Constraints
6 incorrect guesses is a loss (full hangman)
Completing the word before 6 incorrect guesses is a win
0 < len(word) <= 35
word is all lowercase alphabet characters (no spaces or symbols)
0 < n <= 50
All guesses are valid lowercase alphabet characters without repetition
All games end after winning or losing
All games are either won or lost
Completing the word before 6 incorrect guesses is a win
0 < len(word) <= 35
word is all lowercase alphabet characters (no spaces or symbols)
0 < n <= 50
All guesses are valid lowercase alphabet characters without repetition
All games end after winning or losing
All games are either won or lost
Example
Input
hangman 8 t n g m z s h a
Output
0 /| Won
Game modes
Fastest
Test cases
Wrong Guesses Test
Input
hangman
8
t
n
g
m
z
s
h
a
Output
0
/|
Won
Validator 1 Validator
Input
codingame
12
d
i
n
o
r
g
z
m
a
s
e
c
Output
0
/|
Won
Reverse Order Test
Input
tree
4
e
r
y
t
Output
0
Won
Validator 2 Validator
Input
bark
6
k
r
s
y
a
b
Output
0
|
Won
Lost Game Test
Input
oops
8
o
q
s
r
y
c
a
j
Output
0
/|\
/ \
Lost
Validator 3 Validator
Input
unfortunate
10
x
e
z
k
r
o
v
u
y
q
Output
0
/|\
/ \
Lost
None Correct Test
Input
sorry
6
z
x
b
a
t
u
Output
0
/|\
/ \
Lost
Validator 4 Validator
Input
none
6
z
x
b
a
u
r
Output
0
/|\
/ \
Lost
Long Word Test
Input
supercalifragilisticexpialidocious
17
a
p
r
t
y
j
s
u
d
c
o
x
g
l
f
e
i
Output
0
|
Won
Validator 5 Validator
Input
antidisestablishmentarianism
13
a
t
i
d
s
l
n
m
z
h
r
e
b
Output
0
Won
Perfect Test
Input
hangman
5
n
g
m
h
a
Output
Won
Validator 7 Validator
Input
perfection
9
e
f
r
c
p
i
t
n
o
Output
Won
Solution language
Solution
Stub generator input