10398 - Rock-paper-scissors   

Description

Rock-paper-scissors is a two player game.  A game can have many rounds.  

In each round, players show one of three signs: Rock, Paper, or Scissors.
Rock wins Scissors; Paper wins Rock; and Scissors wins Paper.
If two players show the same sign, it is a tie, which means no one wins or loses.
 
Write a program to determine who wins the game.
 
You can use the hint to design your code.

Hint:

 

#include

int main()
{
        char name1[10];
        char name2[10];
        char ges1, ges2;

        scanf("%s %s", name1, name2);
        int i;
        int N;

        /* declare any other variable if required */





        scanf("%d", &N);  // N rounds in the game

        getchar();
        for(i=0; i

 

Input

The first line contains two strings, which are the names of two players.  The length of the names is less than ten characters.
The second line contains a number N, indicating how many rounds in this game, 1<=N<=10.
Next, there will be N lines.  Each line has two characters, separated by a space.
Each character can be one of ‘R’, ’S’, or ‘P’, representing Rock, Scissors, and Paper, respectively.
The first character is the sign shown by the first player; and the second character is the sign shown by the second player.
 

 

Output

Print the name of the winner in the game.

If no one wins, print "draw".
 
Notice that there will be a newline in the end.
 

 

Sample Input  Download

Sample Output  Download

Tags




Discuss