UVa 489 Hangman Judge: Analog & string Matching

Source: Internet
Author: User
Tags time limit

489-hangman Judge

Time limit:3.000 seconds

Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem &problem=430

In ' Hangman Judge, the ' You are to write a-program that judges a series of hangman. For each game, the "answer to" puzzle is given as as the guesses. The Rules are the same as the classic game of Hangman, and are given as follows:

The contestant tries to solve to puzzle by guessing one letter at a time.

Every time a guess are correct, the characters in the word "match the Guess'll be" "turned over." For example, if your guess are ' o ' and the word is ' book ', then both ' O ' 's in the solution'll be counted as ' solved .''

Every time a wrong guess is made, a stroke would be added to the drawing of a hangman, which needs 7 strokes to complete. Each unique wrong guess only counts against the contestant once.

If the drawing of the hangman is completed before the contestant has successfully-guessed all the characters of the word, The contestant loses.

If The contestant has guessed the characters of the word before the drawing is complete, the contestant wins the game.

If The contestant does not guess enough letters to either win or lose, the contestant is out.

Your task as the ' Hangman Judge ' is to determine, for each game, whether the contestant wins, loses, or fails to finish A game.

Input

Your program would be given a series of inputs regarding the status of a game. All input to the lower case. The "a" of each of the same section would contain a number to indicate which round of the game is being played; The next line is the solution to the puzzle; The last line are a sequence of the guesses made by the contestant. A round number of -1 would indicate the end of all games (and input).

Output

The output of your program are to indicate which round of the game The contestant is currently playing as as as the Resul T of the game. There are three possible results:

You win.
You lose.
You are chickened out.

Sample Input

1
cheese
chese
2
cheese
abcdefg
3
cheese
abcdefgij
-1

Sample Output

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.