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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=input()
n=len(s)
m=0
cnt=1
for i in range(n-2):
    if s[i]==s[i+2]:
        m+=1
        cnt=i+1
# print(m)
if n-2==m:
    print("Second")
elif n%2==1:
    print("First")
else:
    if n-2-m==1:
        if cnt==1:
            if s[cnt-1]==s[cnt+2]:
                print("First")
            else:
                print("Second")
        elif cnt==n-2:
            if s[cnt-2]==s[cnt+1]:
                print("First")
            else:
                print("Second")
        else:
            if s[cnt-1]==s[cnt+2] and s[cnt-2]==s[cnt+1]:
                print("First")
            else:
                print("Second")
    else:
        print("Second")

Submission status: Wrong Answer

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=input()
n=len(s)
m=0
for i in range(n-2):
    if s[i]==s[i+2]:
        m+=1
# print(m)
if n-2==m:
    print("Second")
elif n%2==1:
    print("First")
else:
    # if n-2-m==1:
    #     print("First")
    # else:
        print("Second")

Submission status: Wrong Answer

Solution code:
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

s=input()
n=len(s)
m=0
for i in range(n-2):
    if s[i]==s[i+2]:
        m+=1
# print(m)
if n-2==m:
    print("Second")
elif n%2==1:
    print("First")
else:
    if n-2-m==1:
        print("First")
    else:
        print("Second")

Submission status: Wrong Answer

Solution code:
import sys
from copy import deepcopy
def input(): return sys.stdin.readline().strip()

def main():
    s = input()
    if s[0] == s[-1]:
        print("Second")
    else:
        print("First")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
s = raw_input()
c = 0
for i in range(1,len(s)-1):
	p = i - 1
	n = i + 1
	if s[p] != s[n]:
		c+= 1
		if i-2 >= 0 and s[p] != s[i-2]:
			c += 1
		if i+2 < len(s) and s[p] != s[i+2]:
			c+=1

print 'First' if c%2 else 'Second'

Submission status: Wrong Answer

Solution code:
s = raw_input()
c = 0
for i in range(1,len(s)-1):
	p = i - 1
	n = i + 1
	if s[p] != s[n]:
		c+= 1
		if i-2 >= 0 and s[p] != s[i-2]:
			c += 1

print 'First' if c%2 else 'Second'

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout
from time import perf_counter

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

s = list(map(str,input()))
poped_item = s.pop(1)

print("Second" if s[0] == s[1] else "First")

if len(s)>=3:
    if s[0] == s[1]:
        print("Second")
    else:
        print("First")

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout
from time import perf_counter

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

s = list(map(str,input()))
poped_item = s.pop(1)

if len(s)>=3:
    print("Second" if s[0] == s[1] else "First")

Submission status: Wrong Answer

Solution code:
from sys import stdin, stdout
from time import perf_counter

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

s = list(map(str,input()))
poped_item = s.pop(1)
print("Second" if s[0] == s[1] else "First")

Submission status: Wrong Answer

Solution code:
s = input()
removable = 0
for left, right in zip(s[:-2], s[2:]):
    removable += int(left != right)

if removable % 2 == 1:
    print('First')
else:
    print('Second')

Submission status: Wrong Answer

Solution code:
import sys
s=0
i=0
S=list(input())
c=len(S)
head=S[0]
rear=S[-1]
m=rear
if head==rear:
  if (c-S.count(head))%2==1:
    print("Second")
    sys.exit()
  else:
    print("First")
    sys.exit()
while i<c:
  if S[i]==rear and m==head:
    s+=1
    m=rear
  if S[i]==head and m==rear:
    s+=1
    m=head
  i+=1
p=c-s
if p%2==1:
  print("First")
else:
  print("Second")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
print("First"if len(set(s))%2else"Second")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
from collections import Counter
cs=Counter(s)
if len(cs.keys())==2:
  print('Second')
else:
  if len(s)%2==0:
    print('Second')
  else:
    print('First')

Submission status: Wrong Answer

Solution code:
import re
from collections import Counter
import sys

s = input()
c = Counter(s)
minc = min(c.values())
if len(c) == 3 and min(c.values()) == 1:
    mink = [k for k, v in c.items() if v == 1][0]
    mini = s.index(mink)
    if c[mini + 1] != c[mini - 1]:
        print("First")
        sys.exit()
if len(s) % 2 == 1:
    if all(s[i] == s[0] for i in range(0, len(s), 2)):
        print("Second")
    else:
        print("First")
else:
    if all(s[i] == s[0] for i in range(0, len(s), 2)) and all(s[i] == s[1] for i in range(1, len(s), 2)):
        print("Second")
    else:
        print("First" if s[0] == s[-1] else "Second")

Submission status: Wrong Answer

Solution code:
import re
from collections import Counter

s = input()
c = Counter(s)
if len(c) == 3 and min(c.values()) == 1:
    print("First")
elif len(s) % 2 == 1:
    if all(s[i] == s[0] for i in range(0, len(s), 2)):
        print("Second")
    else:
        print("First")
else:
    if all(s[i] == s[0] for i in range(0, len(s), 2)) and all(s[i] == s[1] for i in range(1, len(s), 2)):
        print("Second")
    else:
        print("First" if s[0] == s[-1] else "Second")

Submission status: Wrong Answer

Solution code:
s = input()

if len(s) % 2 == 1:
    if all(s[i] == s[0] for i in range(0, len(s), 2)):
        print("Second")
    else:
        print("First")
else:
    if all(s[i] == s[0] for i in range(0, len(s), 2)) and all(s[i] == s[1] for i in range(1, len(s), 2)):
        print("Second")
    else:
        print("First" if s[0] == s[-1] else "Second")

Submission status: Wrong Answer

Solution code:
s = input()

if len(s) % 2 == 1:
    if all(s[i] == s[0] for i in range(0, len(s), 2)):
        print("Second")
    else:
        print("First")
else:
    print("Second")

Submission status: Wrong Answer

Solution code:
s = input()

if all(s[i] == s[0] for i in range(0, len(s), 2)) or all(s[i] == s[-1] for i in range(len(s) - 1, -1, -2)):
    print("Second")
else:
    print("First" if len(s) % 2 else "Second")

Submission status: Wrong Answer

Solution code:
s = input()
a = 1
while a < len(s) - 1 and s[a + 1] == s[0]:
    a += 2
print(a)

b = len(s) - 2
while b > 1 and s[b - 1] == s[-1]:
    b -= 2
print(b)

if a > b:
    print("Second")
else:
    print("First" if (b - a + 1) % 2 == 1 else "Second")

Submission status: Wrong Answer

Solution code:
import re

s = input()
n = len(s)
#print("First" if (len(s) - len(re.findall(r"(.).\1", s))) % 2 else "Second")
s = re.sub(r"(.).\1", r"\1\1", s)
s = re.sub(r"(.).\1", r"\1\1", s)
s = re.sub(r"(.).\1", r"\1\1", s)
print("Second" if (n - len(s)) % 2 else "First")

Submission status: Wrong Answer

Solution code:
s=list(input())

true_num=0
rem_table=[False]*len(s)
for i in range(1,len(s)-1):
  if s[i-1]!=s[i+1]:
    rem_table[i]=True
    true_num+=1
#print(rem_table)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

flag = all(s[i] == s[i + 2] for i in range(len(s) - 2))
flag |= s[0] != s[-1] and len(s) % 2 == 0

if flag:
    print("Second")
else:
    print("First")

Submission status: Wrong Answer

Solution code:
s = input()
flag = all(s[i] == s[i + 2] for i in range(len(s) - 2))

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

Submission status: Wrong Answer

Solution code:
s = input()
idx = 0
n = len(s)
c = 0
for i in range(1,n-1):
    if s[idx] != s[i+1]:
        c += 1
    else:
        idx += 1

sr = s[::-1]
idx = 0
c2 = 0
for i in range(1,n-1):
    if sr[idx] != sr[i+1]:
        c2 += 1
    else:
        idx += 1

c = max(c,c2)

print('First' if c%2 else 'Second')

Submission status: Wrong Answer

Solution code:
s = input()

idx = 0

n = len(s)

c = 0

for i in range(1,n-1):
    if s[idx] != s[i+1]:
        c += 1
    else:
        idx += 1

print('First' if c%2 else 'Second')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = input()

cnt = 0
for i in range(1, len(s) - 1):
    if s[i - 1] != s[i + 1]:
        cnt += 1
if cnt % 2 == 0:
    print("Second")
else:
    print("First")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# Beginner 50 D
s = list(input())

#文字数の偶奇
cont = len(s) % 2

#文字の種類数の偶奇
vari = len(set(s)) % 2

#両端が同じ文字かどうか
edge = 0
if s[0] == s[-1]:
    edge = 0
else:
    edge = 1

def judge(a,b,c):
    key = str(a) + str(b) + str(c)
    winner = {
        "000" : "Second",
        "001" : "Second",
        "010" : "First",
        "011" : "Second",
        "100" : "Second",
        "101" : "First",
        "110" : "Second",
        "111" : "First"
    }
    print(winner[key])

judge(cont, vari, edge)

Submission status: Wrong Answer

Solution code:
# Beginner 50 D
s = list(input())

#文字数の偶奇は？
w_cont = len(s) % 2

#文字の種類数の偶奇は？
w_vari = len(set(s)) % 2

#両端がどうなっているか
edge = 0
if s[0] == s[-1]:
    edge = 0
else:
    edge = 1

def judge(a,b,c):
    key = str(a) + str(b) + str(c)
    winner = {
        "000" : "Second",
        "001" : "Second",
        "010" : "First",
        "011" : "Second",
        "100" : "Second",
        "101" : "First",
        "110" : "Second",
        "111" : "First"
    }
    print(winner[key])

judge(w_cont, w_vari, edge)

Submission status: Wrong Answer

Solution code:
# Beginner 50 D
s = list(input())

#文字数の偶奇は？
w_cont = len(s) % 2

#文字の種類数の偶奇は？
w_vari = len(set(s)) % 2

#両端がどうなっているか
edge = 0
if s[0] == s[len(s)-1]:
    edge = 0
else:
    edge = 1

def judge(a,b,c):
    key = str(a) + str(b) + str(c)
    winner = {
        "000" : "Second",
        "001" : "Second",
        "010" : "First",
        "011" : "Second",
        "100" : "Second",
        "101" : "First",
        "110" : "Second",
        "111" : "First"
    }
    print(winner[key])

judge(w_cont, w_vari, edge)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
if n == 3 and s[0] == s[2]:
    print("Second")
    exit()
flag = 0
if s[0] == s[-1]:
    flag = 1
    for i in range(2, n):
        if s[i]!=s[i - 2]:
            flag = 0
            break
if flag == 1:
    print("Second")
elif n % 2 == 1:
    print("First")
else:
    print("Second")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
l = len(S)
l2 = l // 2

if S[0] != S[-1]:
  if l2 == 0:
    winner = "Second"
  else:
    winner = "First"
else:
  if l2 == 0:
    winner = "First"
  else:
    winner = "Second"

print(winner)

Submission status: Wrong Answer

Solution code:
s = input()
abc_dic = {}
sa = []
for i in range(len(s)):
  if s[i] not in abc_dic:
    abc_dic[s[i]] = i
  else:
    sa.append(i - abc_dic[s[i]]-1)
    abc_dic[s[i]] = i
    
if sum(sa) == 0:
  if len(s) % 2 == 0:
    print("Second")
  else:
    print("First")
elif sum(sa) % 2 ==0:
  print("First")
else:
  print("Second")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

isSame = S[0] == S[-1]

print('Second' if isSame and len(S) % 2 == 1 else 'First')

Submission status: Wrong Answer

Solution code:
#解説を参考にした
s = input()
if len(s) % 2 == 0 or s[0] == s[len(s) - 1]:
    print("Second")
else:
    print("First")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
s = input()
t = deepcopy(s)
n = len(s)
flg = 0
x = 2
if s[0] == s[n-1]:
  if n%2:
    print("Second")
  else:
    print("First")
  exit()
for i in range(1,n-1):
  if s[i] == s[0] and flg:
    x += 1
    flg = 0
  elif s[i] == s[n-1] and not flg:
    x += 1
    flg = 1
if (n-x)%2:
  print("First")
else:
  print("Second")

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
s = input()
t = deepcopy(s)
n = len(s)
flg = 1
while flg:
  flg = 0
  final = [s[0]]
  for i in range(1,n-1):
    if s[i-1] != s[i] != s[i+1] != s[i-1]:
      flg = 1
      continue
    final.append(s[i])
  final.append(s[-1])
  s = deepcopy(final)
  n = len(s)
if (len(t)-len(s))%2:
  print("First")
else:
  print("Second")

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = input()
c = Counter(s)
if len(c) == 2:
    print('Second')
else:
    tmp = len(s) - c[s[0]]
    a = s[0]
    if s[0] != s[-1]:
        b = s[-1]
    else:
        cc = sorted(c.keys(), key=lambda x:-c[x])
        for i in cc:
            if i != s[0]:
                tmp -= c[i]
                b = i
                break
    cnt = 0
    for i in range(1,len(s)-1):
        if not (s[i-1] == s[i+1]):
            cnt += 1
    # print(cnt)
    # print(tmp)
    # print((len(s) - c[s[0]] - c[s[-1]]), c[s[0]], c[s[-1]])
    print('First' if cnt % 2 else 'Second')

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = input()
c = Counter(s)
if len(c) == 2:
    print('Second')
else:
    tmp = len(s) - c[s[0]]
    a = s[0]
    if s[0] != s[-1]:
        b = s[-1]
    else:
        cc = sorted(c.keys(), key=lambda x:-c[x])
        for i in cc:
            if i != s[0]:
                tmp -= c[i]
                b = i
                break
    cnt = 0
    for i in range(1,len(s)-1):
        if not (s[i-1] == a and s[i+1] == a or s[i-1] == b and s[i+1] == b):
            cnt += 1
    # print(cnt)
    # print(tmp)
    # print((len(s) - c[s[0]] - c[s[-1]]), c[s[0]], c[s[-1]])
    print('First' if cnt % 2 else 'Second')

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = input()
c = Counter(s)
if len(c) == 2:
    print('Second')
else:
    tmp = len(s) - c[s[0]]
    if s[0] != s[-1]:
        tmp -= c[s[-1]]
    else:
        cc = sorted(c.keys(), key=lambda x:-c[x])
        for i in cc:
            if i != s[0]:
                tmp -= c[i]
                break
    # print(tmp)
    # print((len(s) - c[s[0]] - c[s[-1]]), c[s[0]], c[s[-1]])
    print('First' if tmp % 2 else 'Second')

Submission status: Wrong Answer

Solution code:
from collections import Counter
s = input()
c = Counter(s)
if len(c) == 2:
    print('Second')
else:
    print('First' if len(s) % 2 else 'Second')

Submission status: Wrong Answer

Solution code:
# 文字が2種類になるまで減る
# 2種類になったら終了
# 両端の文字が違うならその2種類が残る→偶数個残る
# 両端の文字が同じならその文字+1種→奇数個残る

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# import numpy as np
# import math
import sys
input = sys.stdin.readline


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

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


main()

Submission status: Wrong Answer

Solution code:
# 入力値
s = input()

# 手番管理
# 先行: 1, 後攻: -1
turn = 1

# 両サイド以外で、計何文字抜けるか調べる
cnt=0
for i in range(1,len(s)-1):
    if s[i-1] != s[i+1]:
        cnt +=1
            
print("First" if cnt % 2 ==1 else "Second")

Submission status: Wrong Answer

Solution code:
# 入力値
s = input()

# 手番管理
# 先行: 1, 後攻: -1
turn = 1

# 終了条件は、残り2文字になった時
while len(s) != 2:
    # 両サイド以外のどの文字が抜けるか調べる
    for i in range(1,len(s)-1):
        if s[i-1] != s[i+1]:
            print(s, s[i])
            s = s[0:i]+s[i+1:]
            turn *= -1
            break
    break
    
# 手番の人が負け
if turn == 1:
    print("Second")
else:
    print("First")

Submission status: Wrong Answer

Solution code:
# 入力値
s = input()

# 手番管理
# 先行: 1, 後攻: -1
turn = 1

# 終了条件は、残り2文字になった時
while len(s) != 2:
    # 両サイド以外のどの文字が抜けるか調べる
    for i in range(1,len(s)-1):
        if s[i-1] != s[i+1]:
            s.lstrip(s[i])
            turn *= -1
            break
    break
    
# 手番の人が負け
if turn == 1:
    print("Second")
else:
    print("First")

Submission status: Wrong Answer

Solution code:
# 入力値
s = input()

# 手番管理
# 先行: 1, 後攻: -1
turn = 1

# 終了条件は、残り2文字になった時
while len(s) != 2:
    # 両サイド以外のどの文字が抜けるか調べる
    for i in range(1,len(s)-1):
        print(s[i-1], s[i], s[i+1])
        if s[i-1] != s[i+1]:
            s.lstrip(s[i])
            turn *= -1
            break
    break
    
            
if turn == 1:
    print("Second")
else:
    print("First")

Submission status: Wrong Answer

Solution code:
# 入力値
s = input()

# 手番管理
# 先行: 1, 後攻: -1
turn = 1

# 終了条件は、残り2文字になった時
while len(s) != 2:
    print(s)
    # 両サイド以外のどの文字が抜けるか調べる
    for i in range(1,len(s)-1):
        print(s[i-1], s[i], s[i+1])
        if s[i-1] != s[i+1]:
            s.lstrip(s[i])
            turn *= -1
            break
    break
    
            
if turn == 1:
    print("Second")
else:
    print("First")

Submission status: Wrong Answer

Solution code:
s = input()
N = len(s)
ans = ["First", "Second"]
alphabet = "abcdefghijklmnopqrstuvwxyz"
memo = [0]*26
for i, x in enumerate(alphabet):
    tmp = -1
    for j, y in enumerate(s):
        if y == x:
            if tmp == -1:
                tmp = j
            else:
                memo[i] = max(memo[i], j - tmp - 1)
                tmp = j
player = N - 3
if max(memo) > 0:
    player = max(memo)

print(ans[player % 2])

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
S = list(input())[: -1]
d = dd(int)
t = len(S) - 2
for i in range(len(S)):
  d[S[i]] += 1
for k in d.keys():
  t -= min(d[k] - 1, 1)
if t % 2: print("First")
else: print("Second")

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
S = list(input())[: -1]
d = dd(int)
t = len(S) - 2
for i in range(len(S)):
  d[S[i]] += 1
for k in d.keys():
  t -= d[k] - 1
if t % 2: print("First")
else: print("Second")

Submission status: Wrong Answer

Solution code:
S = input()
consecNum = [1]
consecType = [S[0]]
last = None
for c in range(1, len(S)-1):
    if last != S[c]:
        last = S[c]
        consecNum.append(0)
        consecType.append(S[c])
    consecNum[-1] += 1
consecNum.append(1)
consecType.append(S[-1])

canBeRemoved = [False for i in range(len(consecNum))]
for i in range(1, len(consecNum) - 1):
    canBeRemoved[i] = consecType[i - 1] != consecType[i + 1]
    
total = 0
for i in range(1, len(consecNum) - 1):
    if consecType[i-1] == consecType[i+1] and (canBeRemoved[i - 1] + canBeRemoved[i+1]) % 2 == 0:
        total += consecNum[i] - 1
    else:
        total += consecNum[i]

print("Second" if total % 2 == 0 else "First")

Submission status: Wrong Answer

Solution code:
S = input()
consecNum = [1]
consecType = [S[0]]
last = None
for c in range(1, len(S)-1):
    if last != S[c]:
        last = S[c]
        consecNum.append(0)
        consecType.append(S[c])
    consecNum[-1] += 1
consecNum.append(1)
consecType.append(S[-1])

total = 0
for i in range(1, len(consecNum) - 1):
    if consecType[i-1] == consecType[i+1]:
        total += consecNum[i] - 1
    else:
        total += consecNum[i]

print("Second" if total % 2 == 0 else "First")

Submission status: Wrong Answer

Solution code:
S = input()
total = 0
for i in range(1, len(S) - 1):
    if S[i-1] != S[i+1]: total += 1
print("Second" if total % 2 == 0 else "First")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
f = 1 
h = {-1:"First", 1:"Second"}
p = 0 
for i in range(len(s)*2):
        if p+2 < len(s):
                if s[p] != s[p+2]:
                        del s[p+1]
                        f = -f
                else:
                        p += 1
        elif p > 0:
                p -= 1
        else:
                break
print(h[f])

Submission status: Wrong Answer

Solution code:
s = list(input())
p = 0 
f = 1 
h = {-1:"First", 1:"Second"}
for i in range(len(s)):
        if p+2 < len(s):
                if s[p] != s[p+2]:
                        del s[p+1]
                        f = -f
                else:
                        p += 1
        else:
                p -= 1
print(h[f])

Submission status: Wrong Answer

Solution code:
s = list(input())
p = 0 
f = 1 
h = {-1:"First", 1:"Second"}
for i in range(len(s)):
        if p+2 < len(s):
                if s[p] != s[p+2]:
                        del s[p+1]
                        f = -f
                else:
                        p += 1
if len(s) > 2 and s[0] != s[2]:
        del s[1]
        f = -f
print(h[f])

Submission status: Wrong Answer

Solution code:
s=input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input())
str_count = 0
for char in s:
    if char == s[0] or char == s[-1]:
        str_count += 1

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

else:
    available_char_num = len(s) - 2

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

Submission status: Wrong Answer

Solution code:
s = list(input())
str_count = 0
for char in s:
    if char == s[0] or char == s[-1]:
        str_count += 1

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

else:
    available_char_num = len(s) - str_count

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

Submission status: Wrong Answer

Solution code:
s=input()
a,b=s[0],s[-1]
if a!=b:
  ct=0
  n=len(s)
  cur=a
  for i in range(1,n-1):
    if cur==a:
      if s[i]==b:
        cur=b
        continue
      else:
        ct+=1
    else:
      if s[i]==a:
        cur=a
        continue
      else:
        ct+=1
  print("First" if ct%2==1 else "Second")
else:
  s=s[:-1]
  ct=0
  n=len(s)
  cur=a
  for i in range(1,n-1):
    if cur==a:
      if s[i]==b:
        cur=b
        continue
      else:
        ct+=1
    else:
      if s[i]==a:
        cur=a
        continue
      else:
        ct+=1
  print("First" if ct%2==1 else "Second")

Submission status: Wrong Answer

Solution code:
s=input()
a,b=s[0],s[-1]
ct=0
n=len(s)
cur=a
for i in range(1,n-1):
  if cur==a:
    if s[i]==b:
      cur=b
      continue
    else:
      ct+=1
  else:
    if s[i]==a:
      cur=a
      continue
    else:
      ct+=1
print("First" if ct%2==1 else "Second")

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

s=input()

first_c=s[0]
last_c=s[-1]

if first_c==last_c:
  if len(s)%2==0:
    print('First')
  else:
    print('Second')
else:
  if len(s)%2==0:
    print('Second')
  else:
    print('First')

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)
moji1=s[0]
moji2=s[1]
count=0
flag=False
for i in range(n-2):
  if (i+count)%2==0:
    if s[i+2]!=moji1:
      count+=1
      if i+2==n-1:
        flag=True
  else:
    if s[i+2]!=moji2:
      count+=1
  if count==2:
    break
if count==0:
  print('Second')
  exit()
if count==1:
  if flag:
    if (n-2)%2==0:
      print('Second')
    else:
      print('First')
  else:
    print('First')
  exit()
if s[0]==s[-1]:
  if (n-3)%2==0:
    print('Second')
  else:
    print('First')
else:
  if (n-2)%2==0:
    print('Second')
  else:
    print('First')

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)
moji1=s[0]
moji2=s[1]
count=0
for i in range(n-2):
  if (i+count)%2==0:
    if s[i+2]!=moji1:
      count+=1
  else:
    if s[i+2]!=moji2:
      count+=1
  if count==2:
    break
if count==0:
  print('Second')
  exit()
if count==1:
  print('First')
  exit()
if s[0]==s[-1]:
  if (n-3)%2==0:
    print('Second')
  else:
    print('First')
else:
  if (n-2)%2==0:
    print('Second')
  else:
    print('First')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(300000)


def solve(s: str):
    ss = set(s)
    if len(ss) == 2:
        ret = 'Second'
    else:
        if len(s) % 2 == 1 and s[0] == s[-1]:
            ret = 'Second'
        else:
            ret = 'First'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    s = next(tokens)  # type: str
    solve(s)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(1, len(s) - 1):
  if s[i - 1] != s[i + 1]:
    print("First")
    exit(0)
print("Second")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

s = input()

def judge() :
    d = defaultdict(int)
    for s_ in s :
        d[s_] += 1
    
    if len(d) == 3 :
        one = []
        for k, v in d.items() :
            if v == 1 :
                one.append(k)
        
        if len(one) == 1 :
            for i in range(1, len(s) - 1) :
                if s[i] == one[0] :
                    if s[i-1] != s[i+1] :
                        return 'Fisrt'
                    else :
                        return 'Second'

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

s = input()

def judge() :
    d = defaultdict(int)
    
    for s_ in s :
        d[s_] += 1
    
    if len(d) == 3 :
        one = []
        for k, v in d.items() :
            if v == 1 :
                one.append(k)
        
        if len(one) == 1 :
            for i in range(1, len(s) - 1) :
                if s[i] == one[0] :
                    if s[i-1] != s[i+1] :
                        return 'Fisrt'
                    else :
                        break

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

s = input()

def judge() :
    if len(s) == 3 :
        if s[0] == s[2] :
            return 'Second'
        else :
            return 'First'

    d = defaultdict(int)
    
    for s_ in s :
        d[s_] += 1
    
    if len(d) == 3 :
        one = []
        for k, v in d.items() :
            if v == 1 :
                one.append(k)
        
        if len(one) == 1 :
            for i in range(1, len(s) - 1) :
                if s[i] == one[0] :
                    if s[i-1] != s[i+1] :
                        return 'Fisrt'
                    else :
                        break
    
    if (len(s) + 1 if s[0] == s[-1] else 0) % 2 == 1 :
        return 'First'
    else :
        return 'Second'
       
print(judge())