303215: CF626B. Cards

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Cards

题意翻译

## 题目 $Catherine$ 有一副$n$ 张牌,每一张牌要么是红的,要么是绿的,要么是蓝的。只要至少有两张牌,她就可以做两个动作之一: * 取两张(不一定是相邻的)不同颜色的卡片,换成第三种颜色的新卡片; * 取两张(不一定是相邻的)相同颜色的卡片,换成一张有这种颜色的新卡片。 她重复这个过程,直到只剩下一张卡片。最后一张卡可能有什么颜色? ## 输入 输入的第一行包含一个整数$n (1 \le n \le 200)$ 表示总的卡片数。 下一行包含一个长度为$n$ 的字符串$s$ 表示卡片的颜色。$s$ 只包含字符`B`、`G`和`R`,分别代表蓝色、绿色和红色。 ## 输出 输出所有可能的颜色。按顺序输出。 感谢@frankchenfu 提供的翻译

题目描述

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

说明

In the first sample, Catherine has one red card and one blue card, which she must exchange for a green card. In the second sample, Catherine has two green cards and one red card. She has two options: she can exchange the two green cards for a green card, then exchange the new green card and the red card for a blue card. Alternatively, she can exchange a green and a red card for a blue card, then exchange the blue card and remaining green card for a red card. In the third sample, Catherine only has blue cards, so she can only exchange them for more blue cards.

Input

题意翻译

## 题目 $Catherine$ 有一副$n$ 张牌,每一张牌要么是红的,要么是绿的,要么是蓝的。只要至少有两张牌,她就可以做两个动作之一: * 取两张(不一定是相邻的)不同颜色的卡片,换成第三种颜色的新卡片; * 取两张(不一定是相邻的)相同颜色的卡片,换成一张有这种颜色的新卡片。 她重复这个过程,直到只剩下一张卡片。最后一张卡可能有什么颜色? ## 输入 输入的第一行包含一个整数$n (1 \le n \le 200)$ 表示总的卡片数。 下一行包含一个长度为$n$ 的字符串$s$ 表示卡片的颜色。$s$ 只包含字符`B`、`G`和`R`,分别代表蓝色、绿色和红色。 ## 输出 输出所有可能的颜色。按顺序输出。 感谢@frankchenfu 提供的翻译

加入题单

上一题 下一题 算法标签: