atcoder#ABC278F. [ABC278F] Shiritori
[ABC278F] Shiritori
Score : points
Problem Statement
You are given strings . is a non-empty string of length at most consisting of lowercase English letters, and the strings are pairwise distinct.
Taro the First and Jiro the Second play a word-chain game. In this game, the two players take alternating turns, with Taro the First going first. In each player's turn, the player chooses an integer , which should satisfy the following two conditions:
- is different from any integer chosen by the two players so far since the game started;
- the current turn is the first turn of the game, or the last character of equals the first character of , where is the last integer chosen.
The player who is unable to choose a conforming loses; the other player wins.
Determine which player will win if the two players play optimally.
Constraints
- is an integer.
- is a non-empty string of length at most consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
Output
Print First
if Taro the First wins when the two players play optimally; print Second
if Jiro the Second wins.
6
enum
float
if
modint
takahashi
template
First
For example, the game progresses as follows. Note that the two players may not be playing optimally in this example.
- Taro the First chooses .
if
. - Jiro the Second chooses .
float
, and the last character ofif
equals the first character offloat
. - Taro the First chooses .
takahashi
, and the last character offloat
equals the first character oftakahashi
. - Jiro the Second is unable to choose such that starts with
i
, so he loses.
In this case, Taro the First wins.
10
catch
chokudai
class
continue
copy
exec
havoc
intrinsic
static
yucatec
Second
16
mnofcmzsdx
lgeowlxuqm
ouimgdjxlo
jhwttcycwl
jbcuioqbsj
mdjfikdwix
jhvdpuxfil
peekycgxco
sbvxszools
xuuqebcrzp
jsciwvdqzl
obblxzjhco
ptobhnpfpo
muizaqtpgx
jtgjnbtzcl
sivwidaszs
First