Harryxun/stf_run huggingface dataset:
n , m = map(int,input().split())
g = [i for i in range(n)]
def find(x):
    if g[x] == x:
        return x
    g[x] = find(g[x])
    return g[x]
def union(x,y):
    x = find(x)
    y = find(y)
    if x!=y:
        g[x] = y

for i in range(m):
    xi,yi,zi = map(int,input().split())
    union(xi-1,yi-1)

print(len(set([find(i) for i in range(n)])))


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
n , m = map(int,input().split())
g = [i for i in range(n)]
def find(x):
    if g[x] == x:
        return x
    g[x] = find(g[x])
    return g[x]
def union(x,y):
    x = find(x)
    y = find(y)
    if x!=y:
        g[x] = y

for i in range(m):
    xi,yi,zi = map(int,input().split())
    union(xi-1,yi-1)

ans = 0
for i in range(n):
    if find(i) == i:
        ans += 1
print(ans)
nyuu=input()
(a,b)=nyuu,split()
a=int(a)
b=int(b)
c=a*b
if c%2==0:
    print("Odd")
else :
    print("Even")


### FIXED CODE ###

nyuu=input()
(a,b)=nyuu.split()
a=int(a)
b=int(b)
c=a*b
if c%2==1:
    print("Odd")
else :
    print("Even")
n, q = map(int, input().split())
s = input()

# 先に回数を数える。累積和的に
hoge = [s[0:(i + 1)].count('AC') for i in range(n)]

for _ in range(q + 1):
    l, r = map(int, input().split())
    print(hoge[r - 1] - hoge[l - 1])


### FIXED CODE ###

n, q = map(int, input().split())
s = input()

# lr = [list(map(int, input().split())) for _ in range(q)]

# 愚直な計算時間
# ループn回
# リスト切り取りO(n)
# O(n^2)
# 計算リミットが2000msで、n<=10^5
# 0(n)でn=10^6くらいが限度
# O8n^2)だと、n=3000くらい

# 先に回数を数える。累積和的に
# ここで結構時間かかる
# hoge = [s[0:(i + 1)].count('AC') for i in range(n)]

# 修正ver
hoge = [0]
cnt = 0
for i in range(1, n):
    if s[i - 1] + s[i] == 'AC':
        cnt += 1
    hoge.append(cnt)

for _ in range(q):
    l, r = map(int, input().split())
    print(hoge[r - 1] - hoge[l - 1])
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import collections
import heapq


AdjacentVertex = collections.namedtuple("AdjacentVertex", "vertex cost")
INF = 2 ** 31 - 1
NO_VERTEX = -1


# Prim?????§??????0?????????????°???¨?????¨????±???????
def compute_mst_prim(max_v, adj_list):
    # pred[u]?????????u???????????¨???????????????????????¨???
    pred = collections.defaultdict(lambda: NO_VERTEX)
    # u??¨pred[u]????????¶???????????????key[u]?????\???
    key = collections.defaultdict(lambda: INF)
    key[0] = 0
    # ??????????????????????????????????????\?????¨????????¨??????
    pq = []
    for v in range(max_v):
        heapq.heappush(pq, (key[v], v))
    while pq:
        _, u = heapq.heappop(pq)
        for v, v_cost in adj_list[u]:
            if v in (item[1] for item in pq):
                weight = v_cost
                if weight < key[v]:
                    pred[v] = u
                    key[v] = weight
                    heapq.heappush(pq, (weight, v))
    return (pred, key)


def main():
    max_v, max_e = map(int, input().split())
    adjacency_list = collections.defaultdict(set)
    for _ in range(max_e):
        s, t, w = map(int, input().split())
        adjacency_list[s].add(AdjacentVertex(t, w))
        adjacency_list[t].add(AdjacentVertex(s, w))
    #(_, key) = compute_mst_prim(max_v, adjacency_list)
    print(sum(key.values()))


if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
import collections
import heapq


AdjacentVertex = collections.namedtuple("AdjacentVertex", "vertex cost")
INF = 2 ** 31 - 1
NO_VERTEX = -1


# Prim?????§??????0?????????????°???¨?????¨????±???????
def compute_mst_prim(max_v, adj_list):
    # pred[u]?????????u???????????¨???????????????????????¨???
    pred = collections.defaultdict(lambda: NO_VERTEX)
    # u??¨pred[u]????????¶???????????????key[u]?????\???
    key = collections.defaultdict(lambda: INF)
    key[0] = 0
    # ??????????????????????????????????????\?????¨????????¨??????
    pq = [(key[v], v) for v in range(max_v)]
    heapq.heapify(pq)
    # ????????????????????\?????????????????\??£???????????????????????????
    in_pq = array.array("B", (True for _ in range(max_v)))
    while pq:
        _, u = heapq.heappop(pq)
        in_pq[u] = False
        for v, v_cost in adj_list[u]:
            if in_pq[v]:
                weight = v_cost
                if weight < key[v]:
                    pred[v] = u
                    key[v] = weight
                    heapq.heappush(pq, (weight, v))
                    in_pq[v] = True
    return (pred, key)


def main():
    max_v, max_e = map(int, input().split())
    adjacency_list = collections.defaultdict(set)
    for _ in range(max_e):
        s, t, w = map(int, input().split())
        adjacency_list[s].add(AdjacentVertex(t, w))
        adjacency_list[t].add(AdjacentVertex(s, w))
    (_, key) = compute_mst_prim(max_v, adjacency_list)
    print(sum(key.values()))


if __name__ == '__main__':
    main()
while True:
    try:
        M, D = map(int, input().split())
        result = 0
        if D >= 22:
            for i in range(22, D+1):
                i = str(i)
                mm = MAPS[i] if i in MAPS else None
                if mm is not None and mm <= M:
                    result += 1
        print(result)

    except EOFError:
        break

### FIXED CODE ###

while True:
    MAPS = {'22': 4, '23': 6, '24': 8, '25': 10, '26': 12, '27': 14, '28': 16, '29': 18, '32': 6, '33': 9, '34': 12, '35': 15, '36': 18, '37': 21, '38': 24, '39': 27, '42': 8, '43': 12, '44': 16, '45': 20, '46': 24, '47': 28, '48': 32, '49': 36, '52': 10, '53': 15, '54': 20, '55': 25, '56': 30, '57': 35, '58': 40, '59': 45, '62': 12, '63': 18, '64': 24, '65': 30, '66': 36, '67': 42, '68': 48, '69': 54, '72': 14, '73': 21, '74': 28, '75': 35, '76': 42, '77': 49, '78': 56, '79': 63, '82': 16, '83': 24, '84': 32, '85': 40, '86': 48, '87': 56, '88': 64, '89': 72, '92': 18, '93': 27, '94': 36, '95': 45, '96': 54, '97': 63, '98': 72, '99': 81}
    try:
        M, D = map(int, input().split())
        result = 0
        if D >= 22:
            for i in range(22, D+1):
                i = str(i)
                mm = MAPS[i] if i in MAPS else None
                if mm is not None and mm <= M:
                    result += 1
        print(result)

    except EOFError:
        break
def rec(i,j,k):
    if k == N or i == N - 1 or j == N - 1:
        return
    tmp = dp[i][j] + A[k][0] * abs(A[k][1] - i)
    dp[i+1][j] = tmp if tmp > dp[i+1][j] else dp[i+1][j]
    tmp = dp[i][j] + A[k][0] * abs(A[k][1] - N + j + 1)
    dp[i][j+1] = tmp if tmp > dp[i][j+1] else dp[i][j+1]
    rec(i + 1, j, k + 1)
    rec(i, j + 1, k + 1)
    
N = int(input())
A = sorted([(int(j),i) for i, j in enumerate(input().split())])[::-1]

dp = [[0 for _ in range(N)] for _ in range(N)]
rec(0, 0, 0)
ans = -1
for i in range(4):
    for j in range(4):
        if dp[i][j] > ans:
            ans = dp[i][j]
print(ans)

### FIXED CODE ###

from collections import deque

N = int(input())
A = sorted([(int(j),i) for i, j in enumerate(input().split())])[::-1]
d = deque([(0,0)])
dp = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
while(len(d)>0):
    i, j = d.pop()
    if i + j > N - 1:
        continue
    tmp = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - i)
    if tmp > dp[i+1][j]:
        if dp[i+1][j] == 0:
            d.appendleft((i+1,j))
        dp[i+1][j] = tmp
    tmp = dp[i][j] + A[i+j][0] * abs(A[i+j][1] - N + j + 1)
    if tmp > dp[i][j+1]:
        if dp[i][j+1] == 0:
            d.appendleft((i,j+1))
        dp[i][j+1] = tmp
        
ans = -1
for i in range(N):
    for j in range(N):
        if dp[i][j] > ans:
            ans = dp[i][j]
print(ans)
N = int(input())
str(N)
listN = sorted(N)
if listN.count(7) >= 1:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

N = int(input())
listN = sorted(str(N))
if listN.count("7") >= 1:
    print("Yes")
else:
    print("No")
s=str(input())
s[3]='8'
print(s)

### FIXED CODE ###

s=list(str(input()))
s[3]='8'
print(''.join(s))
from collections import deque
n, k = map(int, input().split())
p = list(map(int, input().split()))
p = [(1/num)*(num)*(num+1)/2 for num in p]
d = deque(p[:k])
result = deque()
append = result.append
for el in p[k:]:
    d.popleft()
    d.append(el)
    append(sum(d))
print(max(result))


### FIXED CODE ###

from collections import deque
n, k = map(int, input().split())
p = list(map(int, input().split()))
p = [(1/num)*(num)*(num+1)/2 for num in p]
d = deque(p[:k])
result = temp = sum(d)
popleft = d.popleft
dappend = d.append
for el in p[k:]:
    temp -= popleft()
    dappend(el)
    temp += el
    if result < temp:
        result = temp
print(result)
N=int(input())
X=int(input())
L=[int(input()) for i in range(N)]

print(N,X,L)
D=0
count=0
for i in range(N):
    count+=1
    D+=L[i]
    if D>X:
        print(count)
        break


### FIXED CODE ###

alfa=input().split()
N=int(alfa[0])
X=int(alfa[1])
#L=[int(input().split()) for i in range(N)]
L=input().split()

#print(N,X,L)
D=0
count=1
for i in range(N):
    D+=int(L[i])
    if D>X:
        print(count)
        break
    else:
        count+=1

if D<=X:
    print(count)
x = int(input)
print(x**3)

### FIXED CODE ###

x = int(input())
print(x**3)
def do():
    w,h,x,y=map(int,input().split())
    ar1=(h-y)*w
    ar2=(w-x)*h
    if ar1==ar2:
        return "{} 1".format(ar2)
    elif w%x==0:
        return "{} 0".format(ar2)
    elif h%y==0:
        return "{} 0".format(ar1)
print(do())

### FIXED CODE ###

def do():
    w,h,x,y=map(int,input().split())
    ar=w*h
    if w/2==x and h/2==y:
        return "{} 1".format(ar/2)
    else:
        return "{} 0".format(ar/2)
print(do())
import math
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)

### FIXED CODE ###

from fractions import gcd
import sys
sys.setrecursionlimit(10**7)
a,b = map(int,input().split())
def lcm(x, y):
    return (x * y) // gcd(x, y)
if b != 0:
    print(lcm(a, b))
else:
    print(a)
import collections
N=int(input())
S=list(input())
s=collections.Counter(S)
m=s["R"]*s["G"]*s["B"]
s=0
for i in range(1,N-1):
  for j in range(i,N):
    k=2*j-i
    if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]:
      s+=1
print(m-s)

### FIXED CODE ###

N = int(input())
S = list(input())

R = 0
G = 0
B = 0

for i in range(N):
	if S[i] == 'R':
		R += 1
	elif S[i] == 'G':
		G += 1
	else:
		B += 1
ans = R * G * B
for i in range(N - 2):
	for j in range(i + 1, N - 1):
		k = j + (j - i)
		if k >= N:
			break
		if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
			ans -= 1
print(ans)
n = int(input())
tmp = input().split()
length = len(tmp)
length2 = len(list(set(tmp)))
if length == length2 :
  print("YES")
else:
  print("NO")

### FIXED CODE ###

st = input().split()
ab = input().split()
u = input()
if u == st[0]:
 print(int(ab[0])-1,int(ab[1]))
else:
 print(int(ab[0]),int(ab[1])-1)
a = list(map(int, input().split()))
a.sort()
K = int(input())
 
print(a[2]*(2**k) + a[1] + a[0])
a = list(map(int, input().split()))
a.sort()
K = int(input())

print(a[2]*(2**K) + a[1] + a[0])

### FIXED CODE ###

a = list(map(int, input().split()))
a.sort()
K = int(input())
 
print(a[2]*(2**K) + a[1] + a[0])
a=input()
print(a*a*a)


### FIXED CODE ###

x=int(input())
print(x**3)
d = int(input())
t = int(input())
s = int(input())

if s*t<d:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

d, t, s = map(int, input().split())

if s*t<d:
  print('No')
else:
  print('Yes')
s = sorted(set(input()))

ans = "None"
for i in range(26):
    a = chr(ord("a") + i)
    if s[i] != a:
        ans = a
        break
print(ans)


### FIXED CODE ###

s = sorted(set(input()))

alphabet = [chr(ord("a") + i) for i in range(26)]
ans = "None"
for actual, expected in zip(s, alphabet):
    if actual != expected:
        ans = expected
        break

if ans == "None" and s[len(s)-1] != "z":
    ans = alphabet[len(s)]
print(ans)
#https://atcoder.jp/contests/abc061/tasks/abc061_d



# coding: utf-8
# Your code here!

#input_template
inpPh = 2
debug = True
#debug = False
if not debug:
    inpPh = 0

input1 ='''
3 3
1 2 4
2 3 3
1 3 5 
'''[1:]

input2 ='''
2 2
1 2 1
2 1 1
'''[1:]

input3 ='''
6 5
1 2 -1000000000
2 3 -1000000000
3 4 -1000000000
4 5 -1000000000
5 6 -1000000000
'''[1:]



inputXs = [input1, input2, input3, None]


if debug:
    try:
        inputXs.append(inputA0)
    except:
        pass
    else:
        pass



    
inploc = inpPh - 1 #0,1,2

if inpPh > 0:
    print('selected_input:\n'+inputXs[inploc])


inpX_lst = []
if debug and inpPh > 0:
    inpX_lst = inputXs[inploc].splitlines()


if inpPh == 0:
    N,M = map(int, sys.stdin.readline().split())
else:
    N,M = map(int, sys.stdin.readline().split())

elist = []    

for i in range(M):
    if inpPh == 0:
        ai,bi,ci = map(int, sys.stdin.readline().split())
    else:
        ai,bi,ci = map(int, sys.stdin.readline().split())
    
    ai_loc, bi_loc = ai-1, bi - 1
    elist.append(( ai_loc, bi_loc,ci))

vlist =[ [None,[]] for _ in range(N)]    

for e in elist:
    a,b,c = e
    vlist[a][1].append((a,b,-c))
        
s_loc,g_loc = 0, N-1

vlist[s_loc][0] = 0
#print(vlist)

for v1 in vlist:
    v1_d,v1_elist = v1[0],v1[1]
    #print(v1_d,v1_elist)
    for e in v1_elist:
        a,b,c = e
        v2 = vlist[b]
        v2_d, v2_elist = v2
        if v1_d == None:
            continue
        elif v2_d == None or v2_d > v1_d +c:
            vlist[b][0] = v1_d + c

g0 = vlist[g_loc][0]            

for v1 in vlist:
    v1_d,v1_elist = v1[0],v1[1]
    #print(v1_d,v1_elist)
    for e in v1_elist:
        a,b,c = e
        v2 = vlist[b]
        v2_d, v2_elist = v2
        if v1_d == None:
            continue
        elif v3_d == None or v2_d > v1_d +c:
            vlist[b][0] = v1_d + c

g1 = vlist[g_loc][0]  

if g0 != g1:
    print('inf')
else:
    print(-g0)

#print('res',g0,g1)
for v in vlist:
    #print(v)        
    pass

### FIXED CODE ###

import sys

INF = float('inf')

def Bellmanford(n, edges, r): #r: 始点
    d = [INF] * n
    d[r] = 0
    
    for i in range(n):
        for (u, v, c) in edges:
            if d[u] != INF and d[u] + c < d[v]:
                d[v] = d[u] + c
                if i == n-1 and v == n-1:
                    return 'inf'
    
    return -d[n-1]
    

N, M = map(int, sys.stdin.readline().split())
Edges = [None] * M

for i in range(M):
    ai, bi, ci = map(int, sys.stdin.readline().split())
    Edges[i] = (ai-1, bi-1, -ci)
    
ans = Bellmanford(N, Edges, 0)

print(ans)
N = int(input())
L0 = 2
L1 = 1

for _ in range(N-1):
    L = L1 + L0
    L0 = L1
    L1 = L
print(L)

### FIXED CODE ###

N = int(input())
L0 = 2
L1 = 1
if N == 0:
    print(L0)
elif N == 1:
    print(L1)
else:    
    for _ in range(N-1):
        L = L1 + L0
        L0 = L1
        L1 = L
    print(L)
N, M = map(int, input().split())
UF = [-1] * (N+1)
def find(x):
    global UF
    if UF[x] == -1:
        return x
    else:
        UF[x] = find(UF[x])
        return UF[x]
def union(x,y):
    global UF
    xx = find(x)
    yy = find(y)
    if UF[x] == UF[y] == -1:
        UF[y] = xx
        return
    elif xx == yy:
        return 
    else:
        UF[yy] = xx
        return 
    
for _ in range(M):
    x, y = map(int, input().split())
    union(x,y)
    
cnt = [0] * (N+1)

for i in range(1,N+1):
    z = find(i)
    if z == -1:
        continue
    cnt[z] += 1

print(max(cnt))



### FIXED CODE ###

from collections import Counter 

class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

N,M= map(int, input().split())
uf1=UnionFind(N)

for _ in range(M):
    x, y = map(int, input().split())
    uf1.union(x-1,y-1)

for i in range(N):
    uf1.find(i) 
c = list(Counter(uf1.par).values())
print(max(c))
import fraction


def main():
    n, m = map(int, input().split())
    s = input()
    t = input()
    x = [' '] * n * m
    for i in range(n):
        x[i * m] = s[i]
    for i in range(m):
        if x[i * n] == ' ':
            continue
        if x[i * n] != t[i]:
            print(-1)
            return
    print(n * m // fraction.gcd(n, m))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import fractions


def main():
    n, m = map(int, input().split())
    s = input()
    t = input()
    l = n * m // fractions.gcd(n, m)
    x = {}
    for i in range(n):
        x[i * (l // n)] = s[i]
    for i in range(m):
        if i * (l // m) not in x:
            continue
        if x[i * (l // m)] != t[i]:
            print(-1)
            return
    print(l)


if __name__ == '__main__':
    main()
import numpy as np

h, w, k = map(int, input().split())
s = np.array(
  [[s for s in map(int, input().split())] for _ in range(h)],
  dtype=np.int)

minimum = (h - 1) * (w - 1)
for div_h in range(1 << (h - 1)):
  h_index = np.zeros(h, dtype=np.int)
  cur_index = 0
  for i in range(1, h):
    if div_h & 1:
      cur_index += 1
    h_index[i] = cur_index
    div_h >>= 1
  white_choco = np.zeros(cur_index + 1, dtype=np.int)
  divide = 0
  j = 0
  while j < w:
    for i in range(h):
      if s[i, j]:
        if white_choco[h_index[i]] < k:
          white_choco[h_index[i]] += 1
        else:
          break
    else:
      j += 1
      continue
    white_choco[:] = 0
    divide += 1
  minimum = min(minimum, divide + cur_index)
print(minimum)

### FIXED CODE ###

h, w, k = map(int, input().split())
s = [[int(s_ij) for s_ij in input()] for _ in range(h)]

minimum = (h - 1) * (w - 1)
for div_h in range(1 << (h - 1)):
  h_index = [0] * h
  cur_index = 0
  mask = 1 << (h - 2)
  for i in range(1, h):
    if div_h & mask:
      cur_index += 1
    h_index[i] = cur_index
    mask >>= 1
  white_choco = [0] * (cur_index + 1)
  divide = 0
  j = 0
  flag = False
  while j < w:
    for i in range(h):
      white_choco[h_index[i]] += s[i][j]
    if max(white_choco) > k:
      if flag:
        break
      flag = True
      white_choco = [0] * (cur_index + 1)
      divide += 1
    else:
      j += 1
      flag = False
  else:
    minimum = min(minimum, divide + cur_index)
print(minimum)
N = input()
ans = 0
i = 1

for i in range(N):
    s = str(i+1)
    if len(s) == 1 or len(s) == 3 or len(s) == 5:
        ans += 1

### FIXED CODE ###

N = int(input())
ans = 0
i = 1

for i in range(N):
    s = str(i+1)
    if len(s) == 1 or len(s) == 3 or len(s) == 5:
        ans += 1

print(ans)
c = input()
if c = a:
    print('vowel')
elif c = e:
    print('vowel')
elif c = i:
    print('vowel')
elif c = o:
    print('vowel')
elif c = u:
    print('vowel')
else:
    print('consonant')

### FIXED CODE ###

c = input()
d =['a', 'e', 'i', 'o', 'u']

if c in d:
    print('vowel')
else:
    print('consonant')
def resolve():
    N,K=map(int,input().split())
    a=list(map(int,input().split()))

    A=[0]*20
    B=[0]*20
    mina=min(a)
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(i+1,N):
            if a[j]<a[i]:
                A[a[i]]+=1
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(N):
            if a[j]<a[i]:
                B[a[i]]+=1
    sumA=sum(A)
    sumB=sum(B)
    ans=(0.5*(2*sumA+(K-1)*sumB)*K)%(10**9+7)
    print(ans)

resolve()

### FIXED CODE ###

def resolve():
    N,K=map(int,input().split())
    a=list(map(int,input().split()))

    A=0
    B=0
    mina=min(a)
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(i,len(a)):
            if a[j]<a[i]:
                A+=1
    for i in reversed(range(len(a))):
        if a[i]==mina:continue
        for j in range(len(a)):
            if a[j]<a[i]:
                B+=1
    ans=int(((2*A+(K-1)*B)*K//2)%(10**9+7))
    print('{}'.format(ans))

resolve()
s=input()


def check(s):
    if len(s)==2:return []
    ans=[]
    for i in range(2,len(s)):
        if s[i-2]!=s[i]:ans.append(i-1)
    return ans
def result(limit):
    if limit%2==1:return 'Second'
    if limit%2==0:return 'First'

def go(s,now,limit,past,prev):
    if prev==0:branch[now]=check(s)
    if branch[now]==[]:
        if now==1 and prev!=0:print(result(limit))
        elif now==1 and prev==0:print('Second')
        elif now==2:print('First')
        else:go(past[now-2],now-2,now,past[:-2],1)
    else:
        if now+1==limit:go(past[now-1],now-1,limit,past[:-1],1)
        else:
            x=branch[now].pop()
            s=s[:x]+s[x+1:]
            past+=(s,)
            go(s,now+1,limit,past,0)

def calc(s):
    data=[0 for i in range(len(s))]
    log = {}
    for i in range(len(s)):
        if s[i] in log:
            for j in range(log[s[i]]+1,i):
                data[j]+=1
            log[s[i]]=i
        elif s[i] not in log:
            log[s[i]]=i
    return data


def first(s,first_limit):
    first_branch=check(s)
    if first_branch==[]:
        if first_limit==1:return first_limit+1
        else: return first_limit
    data=calc(s)
    data_can=[]
    for i in first_branch:
        data_can.append(data[i])
    x=data_can.index(max(data_can))
    s=s[:x]+s[x+1:]
    first_limit+=1
    return first(s,first_limit)


first_limit=1
limit=first(s,first_limit)
branch={}
branch[1]=check(s)
past=(s,)
now=1
go(s,now,limit,past,0)

### FIXED 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))