Problem Statement:
You have an exam coming soon, and unfortunately you didn't study at all, so you can't answer any question. The exam will consist of only MCQ questions (multiple choices questions). Each question has 4 choices, and only 1 of them is the correct answer, for simplicity we will represent the answers using the letters A, B, C or D.

Somehow you managed to get the answers for all questions, but the answers were shuffled. You got only the answers, each answer is one of the 4 letters, but you don't know which answer is for which question.

So you decided that you will select just 1 letter, and answer all questions using that letter. Based on the answers you got, you want to select the letter which will guarantee the maximum number of correct answers. Your task is to write a program to find out which letter(s) will guarantee the maximum number of correct answers.


Input Format:
Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 <= T <= 100). Followed by the test cases, each test case is described in one line which contains a non-empty string which consists of up to 100 letters, each letter is 'A', 'B', 'C' or 'D'. Each letter in this string represents one of the answers.


Output Format:
For each test case, print a single line which contains a single integer representing the maximum number of correct answers you can guarantee by answering all questions using the same answer, followed by a space then a string of all possible answers that guarantee that maximum number (the letters of this string should be sorted in increasing order).


Sample Input:
3 ABCA DDD CCAABD


Sample Output:
2 A 3 D 2 AC





Added by: ahmed_aly
Added at: 2014-08-23 14:00:02 UTC
Time Limit: 1 second
Partial score: No
Source:A2OJ FCI-CU Tournament 2014 - Final Round