10449: USACO 2024 February Contest, Bronze Problem 1. Palindrome Game
Description
Definition: A positive integer is a palindrome if it reads the same forward and backward; examples of palindromes include 1, 121, and 9009. Leading zeros are not allowed; e.g., 990 is *not* a palindrome.
There are $T$ ($1\le T\le 10$) independent test cases. For each test case, print who wins the game if both cows play optimally.
Input
Each test case is specified by a single integer $S$.
Output
Constraints
- Inputs 2-4: $S<100$
- Inputs 5-7: $S<10^6$
- Inputs 8-10: $S<10^9$
- Inputs 11-13: No additional constraints.
Sample 1 Input
3
8
10
12
Sample 1 Output
B
E
B
For the second test case, $10$ is not a palindrome, so Bessie cannot remove all the stones on her first move. Regardless of how many stones Bessie removes on her first move, Elsie can always remove all remaining stones on her second move, guaranteeing her win.
For the third test case, it can be proven that Bessie wins under optimal play.