Programming contests

Magas szintű programozási nyelvek 1, egyéni verseny, 2015. április 12.

April 12, 2015 10:00 AM – April 12, 2015 3:00 PM

Guessing Game

Stan and Ollie are playing a guessing game. Stan thinks of a number between 1 and 10, and Ollie guesses what the number might be. After each guess, Stan indicates whether Ollie's guess is too high, too low, or right on.

After playing several rounds, Ollie has become suspicious that Stan cheats, that is, he changes the number between Ollie's guesses. To prepare his case against Stan, Ollie has recorded the transcripts of several games. You are to determine whether or not each transcript proves that Stan is cheating.

Input Specification

The input consists of several transcripts. Each transcript consists of a number of paired guesses and responses. A guess is a line containing a single integer between 1 and 10, and a response is a line containing “too high”, “too low”, or “right on”. Each game ends with “right on”. A line containing 0 follows the last transcript.

Output Specification

For each game, output a line containing “Stan is dishonest” if Stan's responses are inconsistent with the final guess and response. Otherwise, print “Stan may be honest”.

Sample Input

  1. 10
  2. too high
  3. 3
  4. too low
  5. 4
  6. too high
  7. 2
  8. right on
  9. 5
  10. too low
  11. 7
  12. too high
  13. 6
  14. right on
  15. 0
download as text file

Output for Sample Input

  1. Stan is dishonest
  2. Stan may be honest
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019