UVa 489 - Hangman Judge

489 - Hangman Judge
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=430

Summary
A follow the instructions problem.

Explanation
1. The contestant tries to solve to puzzle by guessing one letter at a time. 2. Every time a guess is correct, all the characters in the word that match the guess will be ``turned over. For example, if your guess is ``o and the word is ``book, then both ``os in the solution will be counted as ``solved.'' 3. Every time a wrong guess is made, a stroke will be added to the drawing of a hangman, which needs 7 strokes to complete. Each unique wrong guess only counts against the contestant once.

______         |  |            |  O            | /|\ | |            | / \         __|_            |   |______     |_________|

4. If the drawing of the hangman is completed before the contestant has successfully guessed all the characters of the word, the contestant loses. 5. If the contestant has guessed all the characters of the word before the drawing is complete, the contestant wins the game. 6. If the contestant does not guess enough letters to either win or lose, the contestant chickens out.

Gotchas
Some may misunderstand the third instruction... Look at the input and output to understand better.

Implementations
Easily solved with a list.

Input
1 cheese chese 2 cheese abcdefg 3 cheese abcdefgij 4 cheese aaaaaaa -1

Output
Round 1 You win. Round 2 You chickened out. Round 3 You lose. Round 4 You lose.

Solutions
Code All the Problems