Rock-Paper-Scissors


Submit solution


Points: 1
Time limit: 2.0s
Python 3 5.0s
Memory limit: 512M

Author:
Problem type
Allowed languages
C, C++, Java, Python

Uncle Alden, cousin David, Seamus the cat and Tom the doggo live a simple yet happy life in Cameron Hall. Sometimes the gang receive parcels from David's parents and sometimes from other generous donors. The Colemak keyboard is clearly for Tom; a 3D-printer is for David, a whiteboard would be for Alden and fish would be for Seamus. But for whom was a new game console meant? All four of them quarrelled, but wise Alden had an idea to settle the dispute; play a version of paper-scissors-rock to find the winner. Each player shows a gesture with their hand (paw) representing one of four things: a rock, scissors or paper. Rock beats scissors; scissors beats paper and paper beats rock. Typically this game is played with two people, but there are four friends here, so we need a different way to find a winner. If someone beats all other players, they win. Otherwise, another round is required. Write a program that will determine the winner of a match.

Input Specification

Four lines, each representing the name of the gesture made by Alden, David, Seamus and Tom respectively. The gestures are either rock, paper or scissors.

Output Specification

Print A if Uncle Alden wins. Print D if David wins, S if Seamus wins and T if Tom wins. If it is impossible to find a winner print ?.

Sample Input 1

rock
rock
rock
rock

Sample Output 1

?

Sample Input 2

rock
scissors
scissors
scissors

Sample Output 2

A

Sample Input 3

rock
paper
scissors
scissors

Sample Output 3

?

Comments

There are no comments at the moment.