题库练习 Cards
← 上一题 下一题 →

A10209 | Cards

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Catherine has a deck of $n$ cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can do one of two actions:

- take any two (not necessarily adjacent) cards with different colors and exchange them for a new card of the third color;
- take any two (not necessarily adjacent) cards with the same color and exchange them for a new card with that color.

She repeats this process until there is only one card left. What are the possible colors for the final card?

输入格式

The first line of the input contains a single integer $n$ ( $1<=n<=200$ ) — the total number of cards.

The next line contains a string $s$ of length $n$ — the colors of the cards. $s$ contains only the characters 'B', 'G', and 'R', representing blue, green, and red, respectively.

输出格式

Print a single string of up to three characters — the possible colors of the final card (using the same symbols as the input) in alphabetical order.

输入输出样例

输入 #1
2
RB
输出 #1
G
输入 #2
3
GRG
输出 #2
BR
输入 #3
5
BBBBB
输出 #3
B
C++ 编辑器
输入
输出