Problems > Best of N

Best of N

Difficulty: 900 3000 ms 128 MB

implementation

Alice and Bob play N rounds of rock-paper-scissors (R beats S, S beats P, P beats R). Print the overall winner (ALICE, BOB or DRAW).

Input: the first line has N; the second line has Alice's moves; the third has Bob's.

Output: the series result.

Constraints:

  • 1 ≤ N ≤ 105

Sample Tests

Input 1
3
R P S
S P R
Output 1
DRAW
Input 2
1
R
R
Output 2
DRAW

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.