三人卡牌游戏(ABC 版)AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)Alice, Bob and Charlie are playing Card Game for Three, as below:
Alice、Bob 和 Charlie 正在进行如下的三人卡牌游戏:AI (CI翻译)
- At first, each of the three players has a deck consisting of some number of cards. Each card has a letter
a,borcwritten on it. The orders of the cards in the decks cannot be rearranged. - The players take turns. Alice goes first.
- If the current player's deck contains at least one card, discard the top card in the deck. Then, the player whose name begins with the letter on the discarded card, takes the next turn. (For example, if the card says
a, Alice takes the next turn.) - If the current player's deck is empty, the game ends and the current player wins the game.
- 开始时,三名玩家各自拥有一叠若干张牌。每张牌上写有字母
a、b或c。牌在各自牌堆中的顺序不能改变。 - 三名玩家轮流行动。Alice 首先行动。
- 如果当前玩家的牌堆中至少有一张牌,则弃掉牌堆顶端的牌。接下来由姓名首字母与被弃掉牌上的字母相同的玩家行动。(例如,如果牌上写着
a,则下一回合由 Alice 行动。) - 如果当前玩家的牌堆为空,则游戏结束,当前玩家获胜。
You are given the initial decks of the players. More specifically, you are given three strings $S_A$, $S_B$ and $S_C$. The $i$-th $(1≦i≦|S_A|)$ letter in $S_A$ is the letter on the $i$-th card in Alice's initial deck. $S_B$ and $S_C$ describes Bob's and Charlie's initial decks in the same way.
现在给出三名玩家的初始牌堆。更具体地说,给出三个字符串 $S_A$、$S_B$ 和 $S_C$。$S_A$ 中第 $i$ 个 $(1≦i≦|S_A|)$ 字符表示 Alice 初始牌堆中第 $i$ 张牌上的字母。$S_B$ 和 $S_C$ 分别以相同方式描述 Bob 和 Charlie 的初始牌堆。AI (CI翻译)
Determine the winner of the game.
请确定游戏的获胜者。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1≦|S_A|≦100$$1≦|S_B|≦100$$1≦|S_C|≦100$- Each letter in
$S_A$,$S_B$,$S_C$isa,borc.
$1≦|S_A|≦100$$1≦|S_B|≦100$$1≦|S_C|≦100$$S_A$、$S_B$、$S_C$中的每个字符都是a、b或c。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入按以下格式给出:AI (CI翻译)
S_A
S_B
S_C
S_A
S_B
S_CAI (CI翻译)
Output
输出格式
AI (CI翻译)If Alice will win, print A. If Bob will win, print B. If Charlie will win, print C.
如果 Alice 获胜,输出 A。如果 Bob 获胜,输出 B。如果 Charlie 获胜,输出 C。AI (CI翻译)
样例
aca
accc
ca
A
abcb
aacb
bccc
C
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。