AtCoder Beginner Contest 433
翻译中…
Problem Statement
翻译中…
You are given a string $S$ consisting of lowercase English letters.
翻译中…
Alice and Bob play the following game using this string.
翻译中…
- Prepare an empty string
$T$. - Starting with Alice, they take turns playing.
- On each turn, the player chooses one lowercase English letter and concatenates the chosen letter to the end of
$T$. Here, the player cannot take an action such that$T$after concatenation is not a substring of$S$.
翻译中…
The player who cannot make a move first loses.
翻译中…
Determine which player will win when both players play optimally.
翻译中…
You are given $T$ test cases; solve each of them.
翻译中…
Constraints
翻译中…
$1\le T\le 10^5$$T$is an integer.$S$is a string consisting of lowercase English letters with length between$1$and$2\times 10^5$, inclusive.- The sum of the lengths of
$S$over all test cases is at most$4\times 10^5$.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
T
\text{case}_1
\text{case}_2
\vdots
\text{case}_T
翻译中…
Each test case is given in the following format.
翻译中…
S
翻译中…
Output
翻译中…
Output the answers for the test cases in order, separated by newlines.
翻译中…
For each test case, output Alice if Alice wins when both players play optimally, and Bob if Bob wins.
翻译中…
样例
Input #1
4
ooxo
abrakadabra
atcoderbeginnercontest
baabca
Output #1
Bob
Alice
Alice
Bob
Consider the first test case.
For example, the game proceeds as follows.
- Alice chooses `x`. $T=$ `x`.
- Bob chooses `o`. $T=$ `xo`.
- No matter which lowercase English letter Alice chooses and concatenates to the end of $T$, $T$ will not be a substring of $S$, so Alice cannot make a move. At this point, Bob wins.
In this test case, Bob can win no matter how Alice plays. Therefore, output `Bob`.
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。