Answer Pattern Guessing
InterviewTime limit1sMemory limit128 MB
Given an answer string, count matches against three fixed repeating guess patterns and report the highest score and who achieved it.
- Level
Easy2 of 10
- Topics
- Simulation, String, Implementation
- Solved
- No attempts yet
Problem
Three contestants answer a multiple-choice exam by repeating fixed guessing patterns.
Adrian repeats A, B, C.
Bruno repeats B, A, B, C.
Goran repeats C, C, A, A, B, B.
Given the actual answer string for the exam, determine who solved the most questions correctly.
Input
The first line contains the number of questions N. (1 <= N <= 100)
The second line contains the answer string of length N. The string contains only A, B, and C.
Output
Print the highest number of correct answers on the first line.
Then print the ID of each contestant with that score, one per line. If there is more than one, print them in this order: Adrian, Bruno, Goran.