CF626B.Cards

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Catherine has a deck of nn 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 nn ( 1<=n<=2001<=n<=200 ) — the total number of cards.

The next line contains a string ss of length nn — the colors of the cards. ss 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.

首页