Problem A
Code Guessing

Bob tells Alice the positions of her two cards. The goal of Alice is to guess the digits on Bob’s two cards. Can Alice uniquely determine these two digits and guess them correctly?
Input
The input has two integers
Output
If Alice can uniquely determine the two digits on Bob’s
cards, output the two digits on a single line, starting with
the smaller digit. Otherwise, output
Sample Input 1 | Sample Output 1 |
---|---|
6 9 ABBA |
7 8 |
Sample Input 2 | Sample Output 2 |
---|---|
2 5 BAAB |
-1 |