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:
s = input()
if s[0] == s[-1]:
    if len(s) % 2:
        ans = 'Second'
    else:
        ans = 'First'
else:
    if len(s) % 2:
        ans = 'First'
    else:
        ans = 'Second'
print(ans)

Submission status: Accepted

Solution code:
s=input();print(['Second','First'][len(s.rstrip(s[0]))%2])

Submission status: Accepted

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

Submission status: Accepted

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

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

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


if __name__ == '__main__':
    main()

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:
s = raw_input()
ret = 0
if s[0] == s[-1]:
	ret += 1
if len(s) % 2 == 0:
	ret += 1
if ret%2 == 0:
	print "First"
else:
	print "Second"

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections


def solve():
    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")

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    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:
# -*- coding: utf-8 -*-
s = input()
lr_same = (s[0] == s[-1])
odd = len(s)%2

if lr_same ^ odd:
    print("First")
else:
    print("Second")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
count = 0
player = ['First', 'Second']

ans = 0
while ans == 0:
    if len(s) == 2:
        ans = player[(count+1)%2]
    else:
        for i in range(1, len(s)-1):
            if s[i-1]!=s[i+1]:
                s = s[:i]+s[i+1:]
                break
        else:
            ans = player[(count+1)%2]
    count += 1
print(ans)#winner

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()
print("First" if (len(S) % 2) ^ (S[0] == S[-1]) else "Second")

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 = list(input())
l = len(s)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
table = [0] * 30
o = lambda x: ord(x) - ord('a')
kind = 0
for c in s:
    if table[o(c)] == 0:
        kind += 1
    table[o(c)] += 1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = raw_input()
n = len(s)
if s[0] == s[-1]:
    print "First" if n%2 == 0 else "Second"
else:
    print "Second" if n%2 == 0 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 == 1:
        print("First")
    else:
        print("Second")

Submission status: Accepted

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

s = input()
if (len(s) % 2 == 0) and (s[0] == s[-1]):
    print("First")
elif (len(s) % 2 == 0) or (s[0] == s[-1]):
    print("Second")
else:
    print("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()

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

print(solve(s))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
g = (s[0] == s[-1]) ^ (len(s) % 2 != 0)
print(['Second', 'First'][g])

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=raw_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 terminal_str(s):
    for i in range(1, len(s)-1):
        if s[i-1] != s[i+1]:
            return 0
    return 1

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

s = input()

if terminal_str(s):
    print('Second')
else:
    d = {}
    for x in s:
        d[x] = d.pop(x, 0)+1

    if len(d) == 3:
        if 1 in list(d.values()):
            if d.get(s[0]) == 1 or d.get(s[len(s)-1]) == 1:
                if solve(s):
                    print('First')
                else:
                    print('Second')
            else:
                print('First')        
        else:
            if solve(s):
                print('First')
            else:
                print('Second')
    else:
        if solve(s):
            print('First')
        else:
            print('Second')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = raw_input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
def solve(s):
    head = s[0]
    tail = s[-1]
    len_s = len(s)
    res = len_s -2
    if head == tail:
        res -= 1
    for c in s[1:-1]:
        if c != head and c != tail:
            return res%2 == 1 
    return False
print('First' if solve(s) else '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:

def main():
    s = input().strip()
    l = len(s)
    if s[0] == s[-1]:
        l += 1
    if l % 2 == 0:
        print("Second")
    else:
        print("First")

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# D
S = raw_input()

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

print winner

Submission status: Accepted

Solution code:
from collections import Counter
S = raw_input()
c = Counter(S)
if len(c.keys()) == 2:
    print 'Second'
    exit()
c[S[0]] -= 1
c[S[-1]] -= 1
if S[0] == S[-1]:
    print 'First' if sum(c.values()) % 2 == 0 else 'Second'
else:
    print 'First' if sum(c.values()) % 2 == 1 else 'Second'

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
S = input()

first_ = True

num = 0
pos = 1
while len(S) >= 3:
    ok = False
    for i in range(pos, len(S)-1):
        if S[i-1] == S[i+1]:
            continue
        else:
            S = S[:i] + S[i+1:]
            ok = True
            num += 1
            break
    if not ok:
        break

# print("num = ", num)
if num % 2 == 1:
    print('First')
else:
    print('Second')

Submission status: Accepted

Solution code:
s = raw_input()

if all(e == s[0] for e in s[0::2]) and all(e == s[1] for e in s[1::2]):
    print "Second"
    exit(0)

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**10
mod = 10**9 + 7


def main():
    s = input()
    l = len(s)
    if s[0] == s[-1]:
        if l%2 == 0:
            return 'First'
        return 'Second'
    if l%2 == 1:
        return 'First'
    return 'Second'



print(main())

Submission status: Runtime Error

Solution code:
s = input().strip()
l = len(s)

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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