Hide

Problem D
Set

Languages da en
/problems/saet/file/statement/en/img-0001.jpg

Ane and Bo often play badminton and have built a digital scoreboard.

In badminton, players take turns to score points. A player wins a set by being first to reach at least $21$ points and having at least $2$ points more than the opponent, or by being first to reach $30$ points.

Input

The score is given in the form $a\mathtt-b$, with Ane’s points $a$ and Bo’s points $b$, separated by -. Both $a$ and $b$ are integers between $0$ and $30$.

Output

If Ane has won the set, output “A”. If Bo has won the set, output “B”. If the set is still in progress, output “?”. If the scoreboard is broken and the given score cannot occur, output “!”.

Sample Input 1 Sample Output 1
21-18
A
Sample Input 2 Sample Output 2
23-25
B
Sample Input 3 Sample Output 3
17-2
?
Sample Input 4 Sample Output 4
22-16
!
Sample Input 5 Sample Output 5
0-0
?
Sample Input 6 Sample Output 6
30-30
!

Please log in to submit a solution to this problem

Log in