|
||||||||||
Flipping coinsTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 164 Accepted Submission(s): 14 Problem Description Alice and Bob are playing a game , everyone has a string made of 0/1, Alice's one called A , and Bob's one called B. There is an uniform coin and an empty string $S$. When the game start, every round they toss the coin , if the coin face up, add a '0' to the bottom of $S$, otherwise add a '1'. At the end of every round, they check if A or B becomes a substring of $S$, if A is the substring of $S$ , Alice wins, and if B is the substring of $S$ , Bob wins. In order to avoid the two person win at the same time. A will not be a suffix of B, and B will not be a suffix of A either. Now we get A and B , we want to know whether the game is fair. if it's unfair , who will more going to be winner? Input There is a number T shows there are T test cases below. ($T \leq 50$) For each test case contains a line , including the string A and B. $1 \leq |A|,|B| \leq 100$ Output For each case output, if the game is fair , output "Fair" , otherwise output "A" or "B" who has more chance to win. Sample Input
Sample Output
Source | ||||||||||
|