Description

Senators in Dota2 from two parties vote to ban opposite party members. Return which party wins when senators vote optimally in circular order.

Examples

Input:senate = "RD"
Output:"Radiant"
Explanation:

R bans D first.

Input:senate = "RDDR"
Output:Dire
Explanation:

Round 1: R bans first D (RDDR → RDR), first D bans R (RDR → DR), second R bans second D (DR → R). Round 2: Only R remains, but since Dire had the last active senator before elimination, Dire wins.

Input:senate = "DRDRDR"
Output:Dire
Explanation:

Round 1: D bans first R (DRDRDR → DDRDR), first R bans second D (DDRDR → DRDR), second D bans second R (DRDR → DDR), third R bans third D (DDR → DR). This continues alternating until Dire has more remaining senators.

Constraints

  • 1 ≤ senate.length ≤ 10⁴

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!