ZOJ Problem Set - 3654
Letty Whiterock is a seasonal youkai who's only seen during winter. She seems fittingly cold towards most of the humans she meets, and many humans fear her abilities. However, because she shares the same ability with Cirno, she is one of Cirno's friend.
Letty Whiterock doesn't good at maths, so she asks Cirno to teach her - of course it's a bad idea - so that she can calculate quickly.
Cirno gives Letty some problems which have a expression with only '+' and '-' and two selection. Also, Cirno tells Letty how to calculate them:
To make the problem more clear:
Cirno thinks these problems can practise Letty's ability on maths. However, she doesn't sure about the answer of some questions. Please help Cirno to teach Letty!
The input contains less than 1000 test cases. NOTICE that's no empty line between each test case.
For each test case, first line is a expression, whose length will not exceed 1000. The expression only contains numbers, '+' and '-'. And the expression is always legal.
The second line has two numbers, which mean the two selection. The two numbers' absolute value will not exceed 263-1.
Process to END_OF_FILE.
For each test case, output "A" (without quotes) for choose the first selection and "B" (without quotes) for choose the second selection. The order of the selection is same as the order which appears in input.
1+2+3+4+5+6 9 21 1-2 -1 -2
Author: DAI, Longao