CF1926A.Vlad and the Best of Five

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Vlad and the Best of Five

Vladislav has a string of length 55, whose characters are each either A or B.

Which letter appears most frequently: A or B?

Input

The first line of the input contains an integer tt (1t321 \leq t \leq 32) — the number of test cases.

The only line of each test case contains a string of length 55 consisting of letters A and B.

All tt strings in a test are different (distinct).

Output

For each test case, output one letter (A or B) denoting the character that appears most frequently in the string.

Samples

8
ABABB
ABABA
BBBAB
AAAAA
BBBBB
BABAA
AAAAB
BAAAA
B
A
B
A
B
A
A
A

在线编程 IDE

建议全屏模式获得最佳体验