Rock Paper Scissors!
Submissions: 2003   Accuracy:

58.11%

  Difficulty: Basic   Marks: 1

The RPS world championship is here. Here two players A and B play the game. You need to determine who wins.
Both players can choose moves from the set {R,P,S}.
The game is a draw if both players choose the same item.

The winning rules of RPS are given below:

  • Rock crushes scissor
  • Scissor cuts paper
  • Paper envelops rock

Input:
The first line of input contains T denoting the number of testcases. T testcases follow. Each testcase contains single line of input that contains two characters sidebyside. These characters denote the moves of players A and B respectively.

Output:
For each testcase, in a newline, print the winner. If match is draw, print 'DRAW'.

Constraints:
1<= T <= 50

Example:
Input:
7
RR
RS
SR
SP
PP
PS
RP

Output:
DRAW
A
B
A
DRAW
B
B

** For More Input/Output Examples Use 'Expected Output' option **

Author: Shikhar


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.