All problems

Problem 899

Dota2 Senate

Medium · 20 pts · String, Queue, Greedy

Problem

Senators from two parties, Radiant (R) and Dire (D), vote in rounds in the order given. On their turn, each senator who still has rights bans one senator of the other party (removing their rights for all later rounds); the best strategy is to ban the next opposing senator who would vote. When all remaining senators belong to one party, that party wins. Keep a queue of indices for each party; the senator with the smaller index bans the other and re-enters at index + N.

Input

A single string S of the letters R and D.

Output

Print Radiant or Dire.

Constraints

1 <= |S| <= 10000

Example input

RDD

Example output

Dire

Explanation

In RDD, the Radiant senator bans the first Dire senator; the second Dire senator then bans the Radiant one. In the next round only Dire remains, so Dire wins.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Time Needed to Buy Tickets Next: Reveal Cards In Increasing Order