链接:https://www.nowcoder.com/acm/contest/92/A
来源:牛客网
AStringGame
时间限制:C/C++ 2秒,其他语言4秒
空间限制:C/C++ 262144K,其他语言524288K
64bit IO Format: %lld
空间限制:C/C++ 262144K,其他语言524288K
64bit IO Format: %lld
题目描述
Recently Alice and Bob are playing a game about strings. Before starting the game, they should prepare n strings s1, s2, ..., sn and a target string t. It's promised that each of these n strings is a substring of t.
When the game begins, they do the following things alternately while Alice starts first:
When the game begins, they do the following things alternately while Alice starts first:
- Choose a string si from the n strings;
- Append one letter to the chosen string;
- The new string must also be a substring of t.
输入描述:
The input consists of multiple test cases.i
Each test case begins with the non-empty target string t, whose length will not exceed 100000. The second line contains an integer n (1 ≤ n ≤ 100), the number of strings they prepared. Then n lines follow. The i-th line of the following n lines is the string s
. The input guarantees that each of the n strings must be a non-empty substring of t.
The total length of all strings will not exceed 30000000.
输出描述:
For each test case, output the winner "Alice" or "Bob" (without quotes) in one line.
示例1
输入
aaaa 1 a abcabd 1 a