PROG0507 - Rock-paper-scissors-lizard-Spock

Most people probably know the game rock-paper-scissors where two players count down and simultaneously form either a rock (fist), a pair of scissors (two outstretched fingers) or a piece of paper (outstretched hand) with their hands. Rock beats scissors, scissors beat paper and paper beats rock. If both players make the same choice, the game ends in a draw.

Sam Kass and Karen Bryla invented an extension of the classic selection game, and called it rock-paper-scissors-lizard-Spock. It operates on the same basic principle, but includes two additional weapons: the lizard (formed by the hand as a sock-puppet-like mouth) and Spock (formed by the Vulcan salute from the Star Trek series). This reduces the chances of a round ending in a tie (from 1/3 to 1/5). The game was mentioned in four episodes of television series The Big Bang Theory.

In the game rock-paper-scissors-lizard-Spock each player picks a hand-shape, then both players reveal their choices at the same time. The winner is the one who defeats the other. The rules of rock-paper-scissors-lizard-Spock are:

  • scissors cut paper
  • paper covers rock
  • rock crushes lizard
  • lizard poisons Spock
  • spock smashes scissors
  • scissors decapitate lizard
  • lizard eats paper
  • paper disproves Spock
  • Spock vaporizes rock
  • rock crushes scissors

There are fifteen possible pairings of the five gestures. Each gesture beats two of the other gestures and is beaten by the remaining two. In a tie, the process is repeated until a winner is found. The original rules (rock beats scissors, scissors beats paper, paper beats rock) remain the same in the extended version of the game.

Rock-Paper-Scizzors-Lizard-Spock
Graphical representation of the rules of rock-paper-scissors-lizard-Spock, displaying clockwise from top: scissors, paper, rock, lizard and Spock.

Input

The input consists of two lines that each contain the name of a hand gesture that is respectively shown by player1 and player2 in a game of rock-paper-scissors-lizard-Spock: paper, rock, lizard, Spock or scissors.

Output

The output consists of a single line that indicates which player wins the game. This line must contain one of the descriptions below:

  • draw
  • player1 wins
  • player2 wins

Try to restrict the number of conditions that must be checked when deciding which player wins the game.

Example

Input:

Spock
paper

Output:

player2 wins

De meesten kennen wellicht wel het spelletje blad-steen-schaar waarbij twee spelers eerst aftellen en daarna met de hand tegelijkertijd de vorm maken van een steen (een vuist), een schaar (twee uitgestoken vingers) of een blad (een vlakke hand). Hierbij verslaat de steen de schaar, de schaar het blad en het blad de steen. Indien beide spelers dezelfde keuze maken, dan wint geen van beiden.

Sam Kass en Karen Bryla bedachten een uitbreiding van dit klassieke spelletje, en noemden het blad-steen-hagedis-Spock-schaar. Het werkt volgens hetzelfde principe, maar er komen twee extra wapens bij: een hagedis (voorgesteld door met de hand een kousenpopachtige mond te vormen) en Spock (voorgesteld door de Vulcangroet uit de Star Trek reeks te maken). Hierdoor wordt de kans op een gelijkspel kleiner (van 1/3 naar 1/5). In vier afleveringen van de televisiereeks The Big Bang Theory wordt deze uitgebreide variant van het spelletje vermeld.

Bij een spelletje blad-steen-hagedis-Spock-schaar kiezen twee spelers een handgebaar, waarna ze beide hun keuze tegelijkertijd zichtbaar maken. De winnaar is diegene die de andere speler verslaat. De regels van blad-steen-hagedis-Spock-schaar zijn:

  • schaar snijdt blad
  • blad bedekt steen
  • steen plet hagedis
  • hagedis vergiftigt Spock
  • Spock smelt schaar
  • schaar onthoofdt hagedis
  • hagedis eet blad
  • blad weerlegt Spock
  • Spock verdampt steen
  • steen breekt schaar

Er zijn vijftien mogelijke combinaties van de vijf handgebaren. Elk handgebaar verslaat twee van de andere handgebaren en wordt verslaan door de andere twee handgebaren. Bij een gelijkspel wordt de procedure herhaald totdat er een winnaar is. De originele regels uit het spelletje blad-steen-schaar (steen verslaat schaar, schaar verslaat blad en blad verslaat steen) blijven behouden in het uitgebreide spelletje.

Rock-Paper-Scizzors-Lizard-Spock
Grafische voorstelling van de regels van het spelletje blad-steen-hagedis-Spock-schaar. Vanaf boven worden in wijzerzin de handgebaren getoond van schaar, blad, steen, hagedis en Spock.

Invoer

De invoer bestaat uit twee regels die elk de naam van een handgebaar bevatten dat respectievelijk door speler1 en speler2 getoond wordt bij een spelletje blad-steen-hagedis-Spock-schaar: blad, steen, hagedis, Spock of schaar.

Uitvoer

De uitvoer bestaat uit één enkele regel die aangeeft welke speler het spelletje wint. Deze regel moet één van de volgende omschrijvingen bevatten:

  • gelijkspel
  • speler1 wint
  • speler2 wint

Probeer het aantal voorwaarden dat moet getest worden om de winnaar van het spelletje aan te duiden zo beperkt mogelijk te houden.

Voorbeeld

Invoer:

Spock
blad

Uitvoer:

speler2 wint

Added by:Peter Dawyndt
Date:2014-09-19
Time limit:10s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:PY_NBC
Resource:None

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.