P6427 [COCI 2008/2009 #1] PTICE

Description

Adrian, Bruno, and Goran want to join the bird lovers club. However, they do not know that all applicants must pass an entrance exam to join the club. The exam consists of $n$ questions, and each question has three possible answers: `A`, `B`, and `C`. Unfortunately, they cannot tell different kinds of birds apart, so they try to guess the correct answers. Each boy has his own theory about which answer sequence works best: Adrian claims the best sequence is: `A`, `B`, `C`, `A`, `B`, `C`, `A`, `B`, `C`, `A`, `B`, `C`... Bruno is sure this is better: `B`, `A`, `B`, `C`, `B`, `A`, `B`, `C`, `B`, `A`, `B`, `C`... Goran laughs at them and uses this sequence: `C`, `C`, `A`, `A`, `B`, `B`, `C`, `C`, `A`, `A`, `B`, `B`... Write a program that, given the correct answers, determines who among the three gets the most questions correct.

Input Format

The first line contains an integer $n$, the number of questions in the exam. The second line contains a string of length $n$ (containing only `A`, `B`, and `C`), which gives the correct answers to the exam.

Output Format

The first line output an integer $m$, the maximum number of correct answers among the three. Starting from the second line, output the name(s) of the person(s) who got the most correct answers (one per line, in lexicographical order).

Explanation/Hint

#### Constraints For $100\%$ of the testdata, $1 \le n \le 100$. #### Notes #### Source This problem is translated from [COCI2008-2009](https://hsin.hr/coci/archive/2008_2009/) [CONTEST #1](https://hsin.hr/coci/archive/2008_2009/contest1_tasks.pdf) PTICE. Translator: @[mnesia](https://www.luogu.com.cn/user/115711). Translated by ChatGPT 5