G.W. Coding Contest 3 P4: Colourful Arguement

Fred and Fblue are having a heated argument about which colour is better, red or blue, so they hold a vote to determine who’s correct. They’ve assigned you to count the \(N\) votes they’ve collected. Unfortunately, Fred is a dirty cheater, and secretly added an extra vote in favour of red! Due to your tight morals, you want to make sure you disregard that vote.


Input Specification:

The first line of input will contain \(\{\text{1 } \leq N \leq 20 \}\).

The second line of input will contain a sequence of \(N\) characters, either ‘R’ or ‘B’ representing the votes for red or blue respectively.


Output Specification:

The output should be one of three possibilities:

“Red”, if red has the most votes

“Blue”, if blue has the most votes

“Purple”, if the votes are tied


TIME CONSTRAINT: 1s

Sample Input 1:

3
BBR

Sample Output 1:

Blue
Explanation for Sample Input 1:
Blue has more votes than red.


Sample Input 2:

1
R

Sample Output 2:

Purple
Explanation for Sample Input 2:
Since Fred likes to cheat, we know he added an extra vote. Without this extra vote there are no votes for red nor blue, resulting in a tie.

Submit Solution

Problem author: Emma