Reaux! Sham! Beaux!

Time limit1sMemory limit128 MB

Summary
Parse rock-paper-scissors rounds given in multiple languages per player, tally wins, and print each game's score and winner.
Level

Easy3 of 10

Topics
String, Hash map, Simulation
Solved
No attempts yet

Problem

Roshambo is a simple game known all around the world. In German it is called "Schnick, Schnack, Schnuck", in Japanese "Janken", in Spanish "Cachipún", in Polish "Papier, kamień, nożyce", and in Czech "Kámen, nůžky, papír".

Whatever the game is called, its rules are the same. Two players simultaneously form their hand into one of three shapes (symbols): Rock (closed fist), Paper (open hand), or Scissors (two extended fingers). If both show the same symbol, the round is a tie and no points are awarded. Otherwise one symbol wins: Rock blunts Scissors, Scissors cut Paper, and Paper covers Rock.

Your task is to write a program that scores a single game between two players.

Because the players come from different countries, the system must accept input in several languages. The table below lists the names of the three symbols in each language. Note that in some languages a symbol may have two different words.

LanguageCodeRockScissorsPaper
CzechcsKamenNuzkyPapir
EnglishenRockScissorsPaper
FrenchfrPierreCiseauxFeuille
GermandeSteinScherePapier
HungarianhuKo | KoeOllo | OllooPapir
ItalianitSasso | RocciaForbiceCarta | Rete
JapanesejpGuuChokiPaa
PolishplKamienNozycePapier
SpanishesPiedraTijeraPapel

Input

The input contains several games. Each game starts with two lines describing the players. Each of these two lines contains two lowercase letters giving the language code used by the player (see the table above), one space, and the player's name. A name consists of at most twenty upper- or lower-case letters.

After the player descriptions come at most 100 lines, each describing one round. A round is given as two words separated by a single space, naming the symbol shown by the first and the second player respectively. Every symbol is written in the mother tongue of the corresponding player. All allowed words appear in the table above; the first letter is always uppercase and the remaining letters lowercase.

The last round is followed by a line containing a single dash ('-'), after which the next game begins. The only exception is the last game in the input, which is terminated by a dot ('.') instead of a dash.

Output

For each game, print four lines. The first line is the string "Game #G:", where G is the game number, starting at one.

The second line contains the first player's name, a colon (':'), one space, and the number of rounds that player won. The number is followed by one space and the word "points". Use the singular form "point" if (and only if) the number equals one.

The third line has the same format and shows the second player's name and points.

The fourth line shows the game result. It contains the word "WINNER" followed by a colon, a space, and the name of the player with more points. If both players have the same number of points, the fourth line contains "TIED GAME" instead.

Separate two consecutive games with a single blank line.

Hint

Thanks to Wikipedia, the free encyclopedia, for the background information and the symbol names in various languages. If your own language is missing, it may be because Wikipedia has no article about Roshambo in that language.

Examples2

  1. Example 1

    Input
    cs Pepik
    en Johnny
    Nuzky Scissors
    Papir Rock
    Papir Scissors
    -
    de Gertruda
    cs Lenka
    Stein Papir
    Schere Kamen
    .
    
    Expected output
    Game #1:
    Pepik: 1 point
    Johnny: 1 point
    TIED GAME
    
    Game #2:
    Gertruda: 0 points
    Lenka: 2 points
    WINNER: Lenka
    
  2. Example 2

    Input
    cs Petr
    de Hans
    Kamen Schere
    Nuzky Papier
    -
    es Carlos
    jp Yuki
    Piedra Guu
    Tijera Choki
    Papel Paa
    -
    pl Adam
    fr Marie
    Kamien Feuille
    Nozyce Pierre
    Papier Ciseaux
    .
    
    Expected output
    Game #1:
    Petr: 2 points
    Hans: 0 points
    WINNER: Petr
    
    Game #2:
    Carlos: 0 points
    Yuki: 0 points
    TIED GAME
    
    Game #3:
    Adam: 0 points
    Marie: 3 points
    WINNER: Marie