Problem:


Score : 500 points

Problem Statement

There is a string s of length 3 or greater.
No two neighboring characters in s are equal.

Takahashi and Aoki will play a game against each other.
The two players alternately performs the following operation, Takahashi going first:

Remove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.

The player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.

Constraints

3 ≤ |s| ≤ 10^5

s consists of lowercase English letters.

No two neighboring characters in s are equal.

Input

The input is given from Standard Input in the following format:

s

Output

If Takahashi will win, print First. If Aoki will win, print Second.

Sample Input 1

aba

Sample Output 1

Second

Takahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.

Sample Input 2

abc

Sample Output 2

First

When Takahashi removes b from s, it becomes ac.
Then, Aoki cannot perform the operation, since there is no character in s, excluding both ends.

Sample Input 3

abcab

Sample Output 3

First



Sample input:
aba


Sample output:
Second

Submission status: Accepted

Solution code:
a = input()
if a[0] == a[-1] and len(a)%2==0:
  print("First")
elif a[0] == a[-1] and len(a)%2==1:
  print("Second")
elif a[0] != a[-1] and len(a)%2==0:
  print("Second")
elif a[0] != a[-1] and len(a)%2==1:
  print("First")

Submission status: Accepted

Solution code:
s = list(input())

if s[0] == s[len(s)-1]:
    if len(s) % 2 == 0:
        print('First')
    else:
        print('Second')
else:
    if len(s) % 2 == 1:
        print('First')
    else:
        print('Second')

Submission status: Accepted

Solution code:
s=input() #输入
if(s[0]==s[len(s)-1]): #头尾相等
    if(len(s) & 1): # x&1等价于x%2==1
        print('Second')
    else:
        print('First')
else:
    if(len(s) & 1): #头尾不相等
        print('First')
    else:
        print('Second')

Submission status: Accepted

Solution code:
s=input() 
if (s[0]==s[len(s)-1]): 
	if (len(s) & 1):
		print('Second')
	else:
		print('First')
else:
	if (len(s) & 1):
		print('First')
	else:
	    print('Second')

Submission status: Accepted

Solution code:
s = input()
print("First" if (len(s)%2) ^ (s[0]==s[-1]) else "Second")

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
"""
n,x = LI()
a = LI()
ans = 0
for i in range(n-1):
    if a[i]+a[i+1] > x:
        ans += a[i+1]+a[i]-x
        if x > a[i]:
            a[i+1] = x-a[i]
        else:
            a[i+1] = 0
            a[i] = x
print(ans)
"""

#D
s = S()
l = len(s)
k = (s[0] == s[-1])
if (l%2)^k:
    print("First")
else:
    print("Second")
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Accepted

Solution code:
s = input()

if s[0]==s[-1]:
  if len(s)%2==0:
    print("First")
  else:
    print("Second")

else:
  if len(s)%2==0:
    print("Second")
  else:
    print("First")

Submission status: Accepted

Solution code:
def main():
	s = input()
	print(["First", "Second"][((s[0] == s[-1]) ^ (len(s) % 2 == 0))])

main()

Submission status: Accepted

Solution code:
s=input()
print("Second" if (len(s)%2==0)^(s[0]==s[-1]) else "First")

Submission status: Accepted

Solution code:
s=input()
def result(limit):
    if limit%2==1:return 'First'
    if limit%2==0:return 'Second'
first=s[0]
last=s[-1]
if first!=last:
    first_idx=[]
    last_idx=[]
    for x in range(s.count(first)):
        first_idx.append(s.index(first,x))
    for y in range(s.count(last)):
        last_idx.append(s.index(last,y))
    judge=0
    data=[]
    data.append(last_idx.pop())
    while judge<2:
        if judge==0:
            while judge==0:
                if len(first_idx)==0:judge=2
                else:
                    k=first_idx.pop()
                    if k<data[-1]:
                        judge=1
                        data.append(k)
                    
        elif judge==1:
            while judge==1:
                if len(last_idx)==0:judge=2
                else:
                    k=last_idx.pop()
                    if k<data[-1]:
                        judge=0
                        data.append(k)
        
    print(result(len(s)-len(data)))

elif first==last:
    first_idx=[]
    for x in range(s.count(first)):
        first_idx.append(s.index(first,x))
    
    alpha='abcdefghijklmnopqrstuvwxyz'
    counter=[0 for _ in range(len(alpha))]
    for i in range(1,len(first_idx)):
        string=s[first_idx[i-1]+1:first_idx[i]]
        for j in range(len(alpha)):
            if alpha[j] in string:counter[j]+=1
    k = max(counter)
    print(result(len(s)-2*k-1))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/arc064/editorial.pdf
・最終的には両端にある2種類の文字か、両端が同じ文字ならそれとそれ以外のもう1文字以外は残らない。
・なので残った文字数の偶奇は分かる。
・そこから総ターン数が分かるので、偶奇で勝敗が分かる。
"""

import sys
from collections import deque, Counter, defaultdict
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, product, combinations, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial

def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()
N = len(S)

# この条件はxorを使うとスッキリまとまる
if (S[0] == S[-1]) ^ (N % 2 == 0):
    print('Second')
else:
    print('First')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

"""
参考：https://img.atcoder.jp/arc064/editorial.pdf
・最終的には両端にある2種類の文字か、両端が同じ文字ならそれとそれ以外のもう1文字以外は残らない。
・なので残った文字数の偶奇は分かる。
・そこから総ターン数が分かるので、その偶奇で勝敗が分かる。
"""

import sys
from collections import deque, Counter, defaultdict
from math import sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, product, combinations, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from functools import reduce, partial

def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()
N = len(S)

if S[0] == S[-1]:
    if N % 2 == 0:
        print('First')
    else:
        print('Second')
else:
    if N % 2 == 0:
        print('Second')
    else:
        print('First')

Submission status: Accepted

Solution code:
S = input()

if S[0] == S[-1]:
    C1 = True
else:
    C1 = False

if len(S) % 2 == 1:
    C2 = True
else:
    C2 = False

if C1 ^ C2 == 0:
    print('Second')
else:
    print('First')

Submission status: Accepted

Solution code:
S = input()

ans = 0
if (S[0]==S[-1]) ^ (len(S)%2==0):
    print("Second")
else:
    print("First")

Submission status: Accepted

Solution code:
s = input()
n = len(s)
if (n % 2 == 0 and s[0] == s[-1]) or (n % 2 != 0 and s[0] != s[-1]):
    print("First")
else:
    print("Second")

Submission status: Accepted

Solution code:
S=input()
L=len(S)
if S[0]==S[-1]:
    L+=1

if L%2!=0:
    print("First")
else:
    print("Second")

Submission status: Accepted

Solution code:
s = input()
N = len(s)
if s[0] == s[N-1]:
    if N%2 == 0:
        print("First")
    else:
        print("Second")
else:
    if N%2 == 0:
        print("Second")
    else:
        print("First")

Submission status: Accepted

Solution code:
s = input()
is_odd1 = len(s) % 2
is_odd2 = (s[0] == s[-1])
print('Second' if is_odd1 == is_odd2 else 'First')

Submission status: Accepted

Solution code:
# -*- coding: utf-8

s = input()

if (s[0] == s[-1]) ^ (len(s) % 2 == 0):
    print('Second')
else:
    print('First')

Submission status: Accepted

Solution code:
S = input()
t = (S[0] == S[-1])
s = (len(S) % 2 != 0)
if t ^ s:
    print("First")
else:
    print("Second")

Submission status: Accepted

Solution code:
s = input()
t = [i for i in s if i in (s[0],s[-1])]
r = len(t)
for c,d in zip(t[:-1],t[1:]):
    r += c==d
print('Second' if len(s)%2==r%2 else 'First')

Submission status: Accepted

Solution code:
s = input()
if s[0] == s[-1]:
    if len(s) % 2 == 0:
        print('First')
    else:
        print('Second')
else:
    if len(s) % 2 == 0:
        print('Second')
    else:
        print('First')

Submission status: Accepted

Solution code:
s = input()
t = ''
for c in s:
    if c in (s[0],s[-1]):
        t += c
r = len(t)
for c,d in zip(t[:-1],t[1:]):
    if c==d:
        r += 1
if len(s)%2==r%2:
    print('Second')
else:
    print('First')

Submission status: Accepted

Solution code:
s = input()
if s[0]==s[-1]:
    if len(s)%2==0:
        print('First')
    else:
        print('Second')
else:
    if len(s)%2==0:
        print('Second')
    else:
        print('First')

Submission status: Accepted

Solution code:

sS = input().rstrip()
iL = len(sS)

sS1 = sS[0::2]
sS2 = sS[1::2]
iWin = 0
if sS1.count(sS1[0]) == len(sS1) and sS2.count(sS2[0]) == len(sS2):
    iWin = 2
elif sS[0] == sS[-1]:
    if iL % 2 == 1:
        iWin = 2
    else:
        iWin = 1
else:
    if iL % 2 == 1:
        iWin = 1
    else:
        iWin = 2



if iWin == 1:
    print("First")
else:
    print("Second")

Submission status: Accepted

Solution code:
s=input()
if(s[0]==s[len(s)-1]):
    if(len(s)%2==1):
        print('Second')
    else:
        print('First')
else:
    if(len(s)%2==1):
        print('First')
    else:
        print('Second')

Submission status: Accepted

Solution code:
s=input()
print('First'if(s[0]==s[-1])!=bool(len(s)%2)else'Second')

Submission status: Accepted

Solution code:
s = input()
length = len(s)
if s[0] == s[-1]:
    print("First" if length % 2 == 0 else "Second")
else:
    print("Second" if length % 2 == 0 else "First")

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    S = input()

    can_move = False
    for i in range(1, len(S) - 1):
        if S[i - 1] != S[i + 1]:
            can_move = True
    if not can_move:
        print("Second")
        return

    N = len(S)
    if S[0] != S[-1]:
        if N % 2 == 1:
            print("First")
        else:
            print("Second")
    else:
        if N % 2 == 1:
            print("Second")
        else:
            print("First")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
from collections import deque
import copy

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    s = input_raw[0]
    N = len(s)
    is_lose = True
    for i in range(N - 2):
        if (s[i] != s[i + 2]):
            is_lose = False
            break
    if is_lose == True:
        print "Second";
        exit()

    if s[0] == s[N - 1]:
        if N % 2 == 0:
            print "First"
        else:
            print "Second"
    else:
        if N % 2 == 0:
            print "Second"
        else:
            print "First"


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()
if (len(s)%2==0)^(s[0]==s[-1]):
  print("Second")
else:
  print("First")

Submission status: Accepted

Solution code:
s = input()
ans=0
if s[0] == s[-1]:
  ans +=1
ans = (len(s)-ans) %2
if ans == 0:
  print("Second")
else:
  print("First")

Submission status: Accepted

Solution code:
S = input()
L = len(S)

if S[0]==S[-1]:
    if L%2==0:
        print("First")
    else:
        print("Second")
else:
    if L%2==1:
        print("First")
    else:
        print("Second")

Submission status: Accepted

Solution code:
s = input()

if s[0] == s[-1]:
    if len(s) % 2 == 0:
        print("First")
    else:
        print("Second")
else:
    if len(s) % 2 == 0:
        print("Second")
    else:
        print("First")

Submission status: Accepted

Solution code:
S = input()

if S[0] != S[-1]:
    if len(S) % 2 == 1:
        print('First')
    else:
        print('Second')
else:
    if len(S) % 2 == 1:
        print('Second')
    else:
        print('First')

Submission status: Accepted

Solution code:
s = input()
print('First' if (len(s) - 2 - (1 if s[0] == s[-1] else 0)) % 2 else 'Second')

Submission status: Accepted

Solution code:
s = input()
n = len(s)

if n %2 ==0:
    if s[0] == s[-1]:
        print("First")
    else:
        print("Second")
else:
    if s[0] == s[-1]:
        print("Second")
    else:
        print("First")

Submission status: Accepted

Solution code:
s = input()
if s[0] == s[-1]:
  if len(s) % 2 == 1:
    print("Second")
  else:
    print("First")
else:
  if len(s) % 2 == 1:
    print("First")
  else:
    print("Second")

Submission status: Accepted

Solution code:

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from pprint import pprint
from collections import Counter, defaultdict, deque
import queue
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


def Prim(g):
    V = list(g.keys())
    for v in g.values():
        V.extend(list(v.keys()))
    V = list(set(V))

    used = set([])
    q = []
    heapq.heappush(q, (0, V[0]))

    ret = 0
    while q:
        c, v = heapq.heappop(q)

        if v in used:
            continue
        used.add(v)
        ret += c
        for u in g[v]:
            heapq.heappush(q, (g[v][u], u))
    return ret


@mt
def slv(S):
    even = len(S) % 2 == 0
    hte = S[0] == S[-1]
    if even != hte:
        return 'Second'
    return 'First'


def main():
    S = read_str()

    print(slv(S))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

S = list(input())
L = len(S)
if L%2 == 1:
	if S[0] == S[-1]:
		print('Second')
	else:
		print('First')
else:
	if S[0] != S[-1]:
		print('Second')
	else:
		print('First')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 13 15:44:15 2018
ABC048D
@author: maezawa
"""

s = input()

n = len(s)
n0 = s.count(s[0])
n1 = s.count(s[-1])

if s[0] == s[-1]:
    if (n-2*n0+1)%2 != 0:
        print('First')
    else:
        print('Second')
elif (n-2*min(n0,n1))%2 != 0:
    print('First')
else:
    print('Second')

Submission status: Accepted

Solution code:
S = input()

# 最初の状態
if len(S)%2 == 1:
    start = 1
else:
    start = 0
    
# 最後の状態
if S[0] == S[-1]:
    last = 1
else:
    last = 0
    
if (start+last)%2 == 1:
    print("First")
else:
    print("Second")

Submission status: Accepted

Solution code:
def judge(S:str) -> str:
    lenS = len(S)
    # 1.両端が同じなら、残り文字3になるまで続く
    if S[0] == S[-1]:
        if (lenS-3)%2 == 1:
            return "First"
        else:
            return "Second"
        
    # 2.両端が違うなら、最初に交互になっている両端の文字が最終状態
    else:
        last = S[0]
        flag = 1
        for i in range(1,lenS):
            # 最後の文字を発見
            if flag and S[i]==S[-1]:
                last = last + S[-1]
                flag = 0
                
            # 最初の文字を発見
            elif (not flag) and S[i]==S[0]:
                last = last + S[0]
                flag = 1
                
        # 奇数手ならfirstの勝ち
        if (lenS - len(last))%2 == 1:
            return "First"
        else:
            return "Second"
        
S = input()
print(judge(S))

Submission status: Accepted

Solution code:
s = list(input())
if(len(s)%2):
    count = False
else:
    count = True

if (s[0] == s[-1]):
    same = True
else:
    same = False

if (count^same):
    print("Second")
else:
    print("First")

Submission status: Accepted

Solution code:
s = input()
if (s[0] == s[-1]) != bool(len(s) & 1):
  print("First")
else:
  print("Second")

Submission status: Accepted

Solution code:

def main():
    s = list(input())

    if s[0] == s[-1]:
        if len(s) %2 ==0:
            print("First")
        else:
            print("Second")
    else:
        if len(s) % 2==0:
            print("Second")
        else:
            print("First")


if __name__ == "__main__":
        main()

Submission status: Accepted

Solution code:
s = input()

i = 1
ans = 0
while i < (len(s) - 1):
    if (s[i - 1] != s[i + 1]):
        s = s[:i] + s[i + 1:]
        ans = (ans + 1) % 2
        i = 0
    i += 1

if (ans + 1) % 2 == 0:
    print('First')
else:
    print('Second')

Submission status: Accepted

Solution code:
s = input()

ans = {0:'Second', 1:'First'}
if s[0] == s[-1]:
    print(ans[(len(s)-1)%2])
else:
    print(ans[len(s)%2])

Submission status: Accepted

Solution code:
s = input()

ans = 'Second'
idx = 1
while(True):
    if s[idx-1] == s[idx+1] or idx == 0:
        idx += 1
    else:
        s = s[:idx]+s[idx+1:]
        idx -= 1
        if ans == 'First': ans = 'Second'
        else: ans = 'First'
        # print(s, idx)
    if idx == len(s)-1:
        break

print(ans)

Submission status: Accepted

Solution code:
s=input()
if len(s)%2==0:
    if s[0]==s[-1]:
        print("First")
    else:
        print("Second")
else:
    if s[0]==s[-1]:
        print("Second")
    else:
        print("First")

Submission status: Accepted

Solution code:
S = input()
N = len(S)
if S[0] != S[-1]:
    if N%2 == 0:
        print("Second")
    else:
        print("First")
else:
    if N%2 == 0:
        print("First")
    else:
        print("Second")

Submission status: Accepted

Solution code:
S = input()
print('First' if (len(S) % 2 == 
0) == (S[0] == S[-1]) else 'Second')

Submission status: Accepted

Solution code:
s = input()
n = len(s)
if s[0] == s[-1]:
    n -= 1
print(["First","Second"][1-n%2])

Submission status: Accepted

Solution code:
s = input()
print('First' if not (len(s)%2==0)^(s[0]==s[-1]) else 'Second')

Submission status: Accepted

Solution code:
s = input()
if len(s)%2==0:
	if s[0]==s[-1]: print("First")
	else: print("Second")
else:
	if s[0]==s[-1]: print("Second")
	else: print("First")

Submission status: Accepted

Solution code:
from sys import stdin
import collections

s = stdin.readline().rstrip().split()[0]

if len(s) % 2 == 1 and s[0] == s[len(s)-1]:
    print('Second')
elif len(s) % 2 == 1 and s[0] != s[len(s)-1]:
    print('First')
elif len(s) % 2 == 0 and s[0] == s[len(s)-1]:
    print('First')
elif len(s) % 2 == 0 and s[0] != s[len(s)-1]:
    print('Second')

Submission status: Accepted

Solution code:
s = input()
if s[0] == s[-1] and len(s) % 2 == 1 or s[0] != s[-1] and len(s) % 2 == 0: print('Second')
else: print('First')

Submission status: Accepted

Solution code:
strings = list(input())


num = 0
while True:
    if len(strings) <= 2:
        break
    flag = False
    for i, _ in enumerate(strings):
        last = len(strings) - 1
        if i == 0 or i == last:
            continue
        if strings[i-1] != strings[i+1]:
            strings.pop(i)
            num += 1
            flag = True
        else:
            continue
    if not flag:
        break

if not num % 2:
    print('Second')
else:
    print('First')

Submission status: Accepted

Solution code:
S = input()
N = len(S)

x = S[0]
y = S[1]
for i in range(2, N):
    if i % 2 == 0:
        if S[i] != x:
            break
    else:
        if S[i] != y:
            break
else:
    print("Second")
    exit()

if S[0]==S[-1]:
    if N % 2 == 0:
        print("First")
    else:
        print("Second")
else:
    if N % 2 == 0:
        print("Second")
    else:
        print("First")

Submission status: Accepted

Solution code:
s = input()
l = len(s)
a = s[0]
b = s[l-1]

if l % 2 == 0:
  if a == b:
    print("First")
  else:
    print("Second")
else:
  if a == b:
    print("Second")
  else:
    print("First")

Submission status: Accepted

Solution code:
from collections import defaultdict

S=input()
cnt=defaultdict(int)
for i in range(len(S)):
  cnt[S[i]]+=1
ans=0
for a,b in cnt.items():
  if b%2==1:
    ans+=1
if S[0]==S[-1]:
  if ans%2==0:
    print("First")
  else:
    print("Second")
else:
  if ans%2==0:
    print("Second")
  else:
    print("First")

Submission status: Accepted

Solution code:
s = input()

if s[0] == s[-1]:
	flg = 1
else:
	flg = 0

if len(s) % 2 == 0:
	flg += 1

if (flg % 2 == 1):
	print("Second")
else:
	print("First")

Submission status: Accepted

Solution code:
s=raw_input()
if (len(s)%2==0) ^ (s[0]==s[-1]):
	print "Second"
else:
	print "First"

Submission status: Accepted

Solution code:
s = input()
ret = (s[0] == s[-1]) ^ (len(s) % 2 == 1)
if ret:
    print("First")
else:
    print("Second")

Submission status: Accepted

Solution code:
def d_AnOrdinaryGame(s):
    # 解説通り
    cond1 = len(s) % 2 == 0  # sの長さが偶数であるか
    cond2 = s[0] == s[-1]  # sの先頭と末尾の文字が同一か
    cond = cond1 ^ cond2
    if cond:
        return 'Second'
    else:
        return 'First'

s = input().strip()
print(d_AnOrdinaryGame(s))

Submission status: Accepted

Solution code:
s = input()

if int(len(s) % 2 == 0) ^ int(s[0] == s[-1]):
    print("Second")
else:
    print("First")

Submission status: Accepted

Solution code:
s=input()
if (s[0]==s[-1]) != (len(s)%2==0):
 print('Second')
else:
 print('First')

Submission status: Accepted

Solution code:
S = input()
s = []
ans = []
num = 0
count = 0
for i in range(len(S)):
    s.append(ord(S[i]))
while num < len(s) - 2:
    if s[num] is not s[num + 2]:
        s.pop(num + 1)
        num = 0
        count += 1
    else:
        num += 1


for i in range(len(s)):
    ans.append(chr(s[i]))

if count % 2 is 1:
    print('First')
else:
    print('Second')

Submission status: Accepted

Solution code:
import sys

# sys.stdin = open('d1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    s = read_str()
    res = 'First'
    if (len(s) % 2 == 0) ^ (s[0] == s[-1]):
        res = 'Second'
    print(res)


main()

Submission status: Accepted

Solution code:
s = input()
print("Second") if((s[0] == s[-1]) != (len(s)%2 == 0)) else print("First")

Submission status: Accepted

Solution code:
from collections import defaultdict


def solve(s):
    if s[0] == s[-1]:
        if len(s) % 2 == 0:
            return "First"
        return "Second"
    else:
        if len(s) % 2 == 0:
            return "Second"
        return "First"


def main():
    s = input()
    print(solve(s))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
if s[0]==s[-1] and len(s)%2==1 or s[0]!=s[-1] and len(s)%2==0:
    print('Second')
else:
    print('First')

Submission status: Accepted

Solution code:
s = input()
F = "First"
S = "Second"
if s[0] == s[-1:]:#odd
    if len(s)&1:
        print(S)
    else:
        print(F)
else:             #even
    if len(s)&1:
        print(F)
    else:
        print(S)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter


def main():
    s = input()
    # 奇数
    if s[0] == s[-1]:
        if len(s) % 2 == 1:
            print("Second")
        else:
            print("First")
    # 偶数
    else:
        if len(s) % 2 == 1:
            print("First")
        else:
            print("Second")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    s = input()
    n = len(s) - 2
    if s[0] == s[-1]:
        n += 1

    if n % 2:
        ans = 'First'
    else:
        ans = 'Second'

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s = input()

b1 = bool(len(s)%2)
b2 = ( s[0] == s[len(s)-1] )

if b1 ^ b2:
    print("First")
else:
    print("Second")

Submission status: Accepted

Solution code:
s = input()

if s[0] == s[-1]:
    if len(s) % 2 == 0:
        print("First")
    else:
        print("Second")
else:
    if len(s) % 2 == 0:
        print("Second")
    else:
        print("First")

Submission status: Accepted

Solution code:
s = raw_input()
if len(s) % 2 == 0:
    if s[0] == s[-1]:
        print "First"
    else:
        print "Second"
else:
    if s[0] == s[-1]:
        print "Second"
    else:
        print "First"

Submission status: Accepted

Solution code:
s = input()

s_len = len(s)
if (s[0]==s[-1] and s_len%2==0) or (s[0]!=s[-1] and s_len%2==1):
	print("First")
else:
	print("Second")

Submission status: Accepted

Solution code:
#ABC048D

s=raw_input()
if (s[0]==s[-1] and len(s)%2==0) or (s[0]!=s[-1] and len(s)%2!=0):
 print 'First'
else:
 print 'Second'

Submission status: Accepted

Solution code:
s = input()
xor = bool(len(s)%2==0) ^ bool(s[0]==s[-1])
print("Second" if xor else "First")

Submission status: Accepted

Solution code:
s=input();l = len;p = print
if (s[0]==s[-1] and l(s)%2==0) or (s[0]!=s[-1] and l(s)%2==1):
    p("First")
else:
    p("Second")

Submission status: Accepted

Solution code:
s = input()

if s[0] == s[len(s)-1]:
    if len(s) % 2 == 0:
        print("First")
    else:
        print("Second")
else:
    if len(s) % 2 != 0:
        print("First")
    else:
        print("Second")

Submission status: Accepted

Solution code:
import sys
s = raw_input()
 
if s[0] == s[len(s)-1]:
    if len(s) % 2 == 0:
        print "First"
    else:
        print  "Second"
else:
    if len(s) % 2 == 0:
        print  "Second"
    else:
        print  "First"

Submission status: Accepted

Solution code:
s = raw_input()
n = len(s)

if s[0] == s[-1]:
    n -= 1

if n % 2 == 1:
    print "First"
else:
    print "Second"

Submission status: Accepted

Solution code:
s = str(input())
#condition a
if len(s) % 2 == 0:
    a = 1
else:
    a = 0
    
if s[0] == s[-1]:
    b = 1
else:
    b = 0

ans = bin(a^b)

if ans == bin(0b0):
    print("First")
elif ans == bin(0b1):
    print("Second")
else:
    print("Error!")

Submission status: Accepted

Solution code:
s=input();l=len(s)
print("Second"*((s[0]!=s[-1])^l&1or s in s[0:1]*l)or"First")

Submission status: Accepted

Solution code:
s=input()
l=len(s)
print("First"*((s[0]==s[-1])^l&1and(s[0:1]*l)[:l]!=s)or"Second")

Submission status: Accepted

Solution code:
line = list(input())

if line[0] == line[-1]:
  if len(line) % 2 == 0:
    print("First")
  else:
    print("Second")
else:
  if len(line) % 2 == 0:
    print("Second")
  else:
    print("First")

Submission status: Accepted

Solution code:
s=input()
if (s[0]==s[-1] and len(s)%2==0) or (s[0]!=s[-1] and len(s)%2==1):
 print("First")
else:
 print("Second")

Submission status: Accepted

Solution code:
def __main__():
    s = input()

    turn = 0
    s = rem(s)
    while s:
        turn += 1
        s = rem(s)
    if turn % 2 == 0:
        print('Second')
    else:
        print('First')

def rem(s):
    if len(s) == 2:
        return False
    for i in range(len(s) - 2):
        if s[i] != s[i + 2]:
            s = s[:(i + 1)] + s[(i + 2):]
            return s
    return False
    
__main__()

Submission status: Accepted

Solution code:
s = raw_input()
n = len(s)-2

if s[0] == s[len(s)-1]:
    n -= 1

if n % 2 == 1:
    print "First"
else:
    print "Second"

Submission status: Accepted

Solution code:
s = input()

if s[0:1] == s[len(s)-1:len(s)]:
    if len(s) % 2 == 1:
        print("Second")
    else:
        print("First")
else:
    if len(s) % 2 == 1:
        print("First")
    else:
        print("Second")

Submission status: Accepted

Solution code:
#D
s = input()
if s[0] == s[-1]:
    if len(s)%2==0:
        print("First")
    else:
        print("Second")
else:
    if len(s)%2==0:
        print("Second")
    else:
        print("First")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

s = raw_input()

if (s[0] == s[-1]) == (len(s) & 1):
    print 'Second'
else:
    print 'First'

Submission status: Accepted

Solution code:
#!/usr/bin/python2
# -*- coding: utf-8 -*-

import sys

def main():
    s = sys.stdin.readline().rstrip()
    if (s[0] == s[-1]) == (len(s) % 2 == 1):
        print "Second"
    else:
        print "First"

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from functools import lru_cache

@lru_cache
def grundy(s):
    if len(s) == 2:
        return 0
    gs = set()
    for i in range(1, len(s) - 1):
        if s[i - 1] == s[i + 1]:
            continue
        gs.add(grundy(s[:i] + s[i + 1:]))
    for i in range(100):
        if i not in gs:
            return not (i == 0)

def win_first(s):
    return ((s[0] == s[-1]) + len(s)) % 2

def test():
    for i in range(1000000):
        s = str(i)
        for c1, c2 in zip(s[:-1], s[1:]):
            if c1 == c2:
                break
        else:
            assert win_first(s) == grundy(s)

def main():
    print("First" if win_first(input()) else "Second")

main()