Harryxun/stf_run huggingface dataset:
S = input()
L=len(S)
longest=0
for i in range(L):
  for j in range(i+1):
    DUP=S[j:i]
    DUP=DUP.replace("A","#")
    DUP=DUP.replace("T","#")
    DUP=DUP.replace("G","#")
    DUP=DUP.replace("C","#")
    count=0
    for a in range(len(DUP)):
      if DUP[a]=="#":
        count+=1
      else:
        break
    else:
      longest=max(longest,count)
print(longest)
S = input()
L=len(S)
longest=0
for i in range(L):
  for j in range(i+1):
    DUP=S[j:i+1]
    DUP=DUP.replace("A","#")
    DUP=DUP.replace("T","#")
    DUP=DUP.replace("G","#")
    DUP=DUP.replace("C","#")
    count=0
    for a in range(len(DUP)):
      if DUP[a]=="#":
        count+=1
      else:
        break
    else:
      longest=max(longest,count)
print(longest)


### FIXED CODE ###

S = input()
L=len(S)
longest=0
for i in range(L):
  for j in range(i+1):
    DUP=S[j:i+1]
    DUP=DUP.replace("A","#")
    DUP=DUP.replace("T","#")
    DUP=DUP.replace("G","#")
    DUP=DUP.replace("C","#")
    count=0
    for a in range(len(DUP)):
      if DUP[a]=="#":
        count+=1
      else:
        break
    else:
      longest=max(longest,count)
print(longest)
def do():
    w,h,x,y=map(int,input().split())
    ar1=(h-y)*w
    ar2=(w-x)*h
    if w%x==0 and h%y==0:
        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())
def binom(n,r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

def power(n,r):
    res = 1
    for i in range(r):
        res *= n
        res %= p
    return res

n,m,k = list(map(int, input().split()))

p = 998244353

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

num = 0

pw = (m-1)**(n-k-2) % p

for i in range(k+1):
    pw *= m-1
    pw %= p
    num += m * pw * binom(n-1, k - i)
    num %= p

print(num)

### FIXED CODE ###

def binom(n,r):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

def power(n,r):
    res = 1
    for i in range(r):
        res *= n
        res %= p
    return res

n,m,k = list(map(int, input().split()))

p = 998244353

fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, n + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

num = 0

pw = (m-1)**(n-k-1) % p

for i in range(k+1):
    num += m * pw * binom(n-1, k - i)
    num %= p
    pw *= m-1
    pw %= p

print(num)
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0[i] = ceil(time_list[i] / 10) * 10
for j in range(5):
    if time_list[i] == 0:
        sum_list[i] = sum(time_list_0)
    else:
        sum_list[i] = sum(time_list_0) - 10 + time_list[i] % 10
print(min(sum_list))


### FIXED CODE ###

from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0.append(ceil(time_list[i] / 10) * 10)
for j in range(5):
    if time_list[j] % 10 == 0:
        sum_list.append(sum(time_list_0))
    else:
        sum_list.append(sum(time_list_0) - 10 + (time_list[j] % 10))
print(min(sum_list))
a,b=map(int,input().split())
c=0
if a>b:
while a//b>=b:  
  a=a//b
  c+=1
print(c+2)
else:
    print(len(a))


### FIXED CODE ###

a,b=map(int,input().split())
if a<10:
  print(b+(100*(10-a)))
else:
  print(b)
N,K=map(int,input().split())

num=[0]*(N)
for i in range(1,N+1):
    num[i%K]+=1
#print(num)

for a in range(K):
    b=(K-a)%K#a=0なら0 a!=0ならk-aになる賢い手
    c=(K-a)%K
    if (b+c)%K!=0:
        continue
    else:
      	#print(a)
        ans+=num[a]*num[b]*num[c]
        print(a,b,c)
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())

num=[0]*(max(N+1,K))
for i in range(1,N+1):
    num[i%K]+=1
#print(num)
ans=0
for a in range(K):
    b=(K-a)%K#a=0なら0 a!=0ならk-aになる賢い手
    c=(K-a)%K
    if (b+c)%K!=0:
        continue
    else:
      	#print(a)
        ans+=num[a]*num[b]*num[c]
        #print(a,b,c)
print(ans)
N=int(input())
lista=list(map(int,input().split()))
  for _ in range(1,N+1)
print(lista.count(_))

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
for aa in a:
  ans[aa-1]+=1
for an in ans:
  print(an)
a, b = int(input())
if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

a, b = map(int,input().split())
if a <= 8 and b <= 8:
  print("Yay!")
else:
  print(":(")
import math
b = list(map(int,input().split()))
if b[2]>b[1]-1:
    check = math.floor((b[0]*(b[1]-1))/b[1]) - b[0]*math.floor((b[1]-1)/b[1])
else:
    check = math.floor((b[0]*b[2])/b[1]) - b[0]*math.floor(b[2]/b[1])
print(ans)

### FIXED CODE ###

import math
b = list(map(int,input().split()))
ans=0
check=0
if b[2]>b[1]-1:
    check = math.floor((b[0]*(b[1]-1))/b[1]) - b[0]*math.floor((b[1]-1)/b[1])
else:
    check = math.floor((b[0]*b[2])/b[1]) - b[0]*math.floor(b[2]/b[1])
if check>ans:
    ans=check
print(ans)
a=input()
if a=='SUN':
  print(7)
elif a=='MON':
  print(6)
elif a=='TUE':
  print(5)
elif a=='WED':
  pirnt(4)
elif a=='THU':
  print(3)
elif a=='FRI':
  print(2)
elif a=='SAT':
  print(1)
else:
  pass


### FIXED CODE ###

c=0
a=input()
if a=='SUN':
  c+=7
elif a=='MON':
  c+=6
elif a=='TUE':
  c+=5
elif a=='WED':
  c+=4
elif a=='THU':
  c+=3
elif a=='FRI':
  c+=2
else:
  c+=1
print(c)
n,l = map(int, input().split())
Li = []
for i in range(n):
  li = list(input()).sort()
  wrd = "".join(li)
  Li.append(wrd)
else:
  print("".join(Li.sort()))
  

### FIXED CODE ###

n,l = map(int, input().split())
Li = []
i = 0
while i<n:
  Li.append("".join(input()))
  i += 1
else:
  Li.sort()
  print("".join(Li))
s = input()

print(s[0] +　str(len(s) -2) + s[-1])

### FIXED CODE ###

s = input()

print(s[0]+str(len(s)-2)+s[-1])
from collections import deque

n = int(input())
a = list(map(int, input().split()))

b = deque([])
rev = 1
for i in a:
    if rev == 1:
        b.append(i)
        rev = -1
    elif rev == -1:
        b.appendleft(i)
        rev = 1

print(*(b if rev == 1 else b[::-1]))


### FIXED CODE ###

from collections import deque

n = int(input())
a = list(map(int, input().split()))

b = deque([])

rev = 1
for i in a:
    if rev == 1:
        b.append(i)
        rev = -1
    elif rev == -1:
        b.appendleft(i)
        rev = 1

b = list(b)
print(*(b if rev == 1 else b[::-1]))
from fractions import*
l=lambda x,y=x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
s=1
for i in a:s=l(s,i)
print(sum(s//i for i in a)%(10**9+7))

### FIXED CODE ###

from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)
N,M = map(int, input().split())
if N==1 and M==1:
  r = 0
if 0<=N and N>=1 and 2<=M:
  r = M*(M-1)//2
if 2<=N and 0<=M and M<=1:
  r = N*(N-1)//2
if 2<=N and 2<=M:
  r = (N*(N-1)+M*(M-1))//2

print(r)

### FIXED CODE ###

N,M = map(int, input().split())
if N==1 and M==1:
  result = 0
if 0<=N and N<=1 and 2<=M:
  result = M*(M-1)//2
if 2<=N and 0<=M and M<=1:
  result = N*(N-1)//2
if 2<=N and 2<=M:
  result = (N*(N-1)+M*(M-1))//2
  
print(result)
90 * N

### FIXED CODE ###

print((int(input())-2) * 180)
n = int(input())
a = [int(x-i-1) for i,x in enumerate(input().split())]

if len(a)%2==1:
    md = a[len(a)//2]
    ans = 0
    for i in a:
        ans += abs(i-md)
    print(ans)
else:
    md1 = a[len(a)//2]
    md2 = a[len(a)//2]
    ans1 = 0
    ans2 = 0
    for i in a:
        ans1 += abs(i-md1)
        ans2 += abs(i-md2)
    print(min(ans1,ans2))

### FIXED CODE ###

n = int(input())
a = [int(x)-i-1 for i,x in enumerate(input().split())]
a.sort()
if len(a)%2==1:
    md = a[len(a)//2]
    ans = 0
    for i in a:
        ans += abs(i-md)
    print(ans)
else:
    md1 = a[len(a)//2]
    md2 = a[len(a)//2-1]
    ans1 = 0
    ans2 = 0
    for i in a:
        ans1 += abs(i-md1)
        ans2 += abs(i-md2)
    print(min(ans1,ans2))
n=input()
for i in range(len(n)):
  if n[i]=="9":
    n[i]="1"
  else:
    n[i]="9"
print(n)

### FIXED CODE ###

n=input()
c=""
for i in range(len(n)):
  if n[i]=="9":
    c+="1"
  else:
    c+="9"
print(c)
from collections import deque
h,w=list(map(int, input().split()))
s = [input() for _ in range(h)]

water=[[0]*w for _ in range(w)]
water[0][0]=1
a_index=[]
a_column=[]
a_index.append(0)
a_column.append(0)
b=[]
count=0

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            water[i][j]=3000
            count+=1
while water[h-1][w-1]==0:
    for i,j in zip(a_index,a_column):
        if water[i][j]==1:
            if i>0:
                if water[i-1][j]==0:
                    water[i-1][j]+=1
                    b.insert(0,[i-1,j])
            if i<h-1:
                if water[i+1][j]==0:
                    water[i+1][j]+=1
                    b.insert(0,[i+1,j])
            if j>0:
                if water[i][j-1]==0:
                    water[i][j-1]+=1
                    b.insert(0,[i,j-1])
            if j<w-1:
                if water[i][j+1]==0:
                    water[i][j+1]+=1
                    b.insert(0,[i,j+1])
        water[i][j]+=1
    a_index+=[x[0] for x in b]
    a_column+=[x[1] for x in b]

    if not b:
        print(-1)
        exit()
    b=[]

print(h*w-water[0][0]-count)


### FIXED CODE ###

from collections import deque
h,w=list(map(int, input().split()))
s = [input() for _ in range(h)]

water=[[0]*w for _ in range(h)]
water[0][0]=1
a_index=[]
a_column=[]
a_index.append(0)
a_column.append(0)
b=[]
count=0

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            water[i][j]=3000
            count+=1
while water[h-1][w-1]==0:
    for i,j in zip(a_index,a_column):
        if water[i][j]==1:
            if i>0:
                if water[i-1][j]==0:
                    water[i-1][j]+=1
                    b.insert(0,[i-1,j])
            if i<h-1:
                if water[i+1][j]==0:
                    water[i+1][j]+=1
                    b.insert(0,[i+1,j])
            if j>0:
                if water[i][j-1]==0:
                    water[i][j-1]+=1
                    b.insert(0,[i,j-1])
            if j<w-1:
                if water[i][j+1]==0:
                    water[i][j+1]+=1
                    b.insert(0,[i,j+1])
        water[i][j]+=1

    a_index+=[x[0] for x in b]
    a_column+=[x[1] for x in b]

    if not b:
        print(-1)
        exit()
    b=[]

print(h*w-water[0][0]-count)
x = input()

print (x^3)


### FIXED CODE ###

x = int(input())
print (x*x*x)
a,b,c,d=input().split()
if abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b,c,d=map(int, input().split())
if abs(a-c)<=d:
  print('Yes')
elif abs(a-b)<=d and abs(b-c)<=d:
  print('Yes')
else:
  print('No')
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in l:
  t=0
  while(i%2=0):
    i=i//2
    t+=1
  ans=min(ans,t)
print(ans)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
ans=1000
for i in l:
  t=0
  while(i%2==0):
    i=i//2
    t+=1
  ans=min(ans,t)
print(ans)
X = int(input().split())

if X >= 30:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

X = int(input())

if X >= 30:
    print("Yes")
else:
    print("No")
from sys import stdin

P,Q,R = int(stdin.readline().rstrip().split())
print(min(P+Q,Q+R,P+R))

### FIXED CODE ###

from sys import stdin

P,Q,R = map(int,input().split())
print(min(P+Q,Q+R,P+R))
A, P = input().split()
P += A*3
print(P//2)

### FIXED CODE ###

A, P = map(int,input().split())
P += A*3
print(P//2)
a, b, c = map(int, input().spulit())
if a / c <= b:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

d,t,s=map(int,input().split())
if d<=t*s:
    print("Yes")
else:
    print("No")
import heapq
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
AB=AB+[0,0]
for i in range(1,M+1):
  day=M-i
  latest=i
  while AB and AB[-2][0]<=latest:
    a,b=AB.pop(-2)
    heapq.heappush(works,-b)
  if not works:
    continue
  ans-=heapq.heappop(works)

print(ans)


### FIXED CODE ###

import heapq
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(N)]

AB.sort(reverse=True)
works=[]
heapq.heapify(works)
ans=0
for i in range(1,M+1):
  day=M-i
  latest=i
  while AB and AB[-1][0]<=latest:
    a,b=AB.pop()
    heapq.heappush(works,-b)
  if not works:
    continue
  ans-=heapq.heappop(works)

print(ans)
N=int(input())
n=len(str(N))
m=(n//2)
def wari(x):
    array=[]
    if m==0:
        for j in range(9,0,-1):
            if N%j==0:
                c=max(len(str(N//j)),len(str(j)))
                array.append(c)
                break
        
    for i in range(m+1):
        if i==0:
            for j in range(9,0,-1):
                if N%j==0:
                    c=max(len(str(N//j)),len(str(j)))
                    array.append(c)
                    break
        else:
            for j in range((10**(i+1))-1,(10**i)-1,-1):
                if N%j==0:
                    c=max(len(str(N//j)),len(str(j)))
                    array.append(c)
                    break
    return min(array)
print(wari(N))

### FIXED CODE ###

A,B=map(int,input().split())
print((A+B)%24)
s=input()
k=int(input())
if s[0]=='1':
    print(s[1])
else:
    print(s[0])


### FIXED CODE ###

s=input()
len_s=len(s)
cnt=0
k=int(input())
for v in s:
    if v!='1':
        print(int(v))
        break
    else:
        cnt+=1
        if k==cnt:
            print(1)
            break
import math

N = int(input())
A = list(map(int, input().split()))

g = math.gcd(A[0], A[1])
for i in range(2, N):
    g = math.gcd(g, A[i])

print(g)

### FIXED CODE ###

from fractions import gcd

N = int(input())
A = list(map(int, input().split()))

g = [0] * (N + 1)
for i in range(N):
    g[i+1] = gcd(g[i], A[i])

print(g[-1])
import sys
import numpy as np

S = []
for e in sys.stdin:
    S.append(e.rstrip())

H, M = map(int, S[0].split())

meiro = []
for i in range(H):
    meiro.append([])
    for k in S[i + 1]:
        if k == '.':
            meiro[i].append(1)
        else:
            meiro[i].append(0)
meiro_array = np.array(meiro)
susumikata = [[1, 0], [-1, 0], [0, 1], [0, -1]]


def BFS(y, x):
    global max_distance
    if meiro_array[x, y] == 1:
        max_distance = 0
        reached = {(x, y): 0}
        for i in range(H * M):
            zahyous = [k for k, v in reached.items() if v == i]
            for zahyou in zahyous:
                for susumi in susumikata:
                    new_zahyou = tuple([zahyou[0] + susumi[0], zahyou[1] + susumi[1]])
                    if not(0 <= new_zahyou[0] < H and 0 <= new_zahyou[1] < M):
                        a = 0
                    elif new_zahyou not in reached.keys() and meiro_array[new_zahyou] == 1:
                        reached[new_zahyou] = i + 1
                        max_distance = i + 1

    return max_distance


keiro_max = []
for x in range(H):
    for y in range(M):
        keiro_max.append(BFS(x, y))

print(max(keiro_max))


### FIXED CODE ###

C = input()

Alphabet = 'abcdefghijklmnopqrstuvwxyz'
Alphabet_list = [i for i in Alphabet]
print(Alphabet_list[Alphabet_list.index(C)+1])
i = int(input())
a = list(map(int, input().split()))
a.sort
a.reverse
alice = a[0::2]
bob = a[1::2]
print(alice - bob)

### FIXED CODE ###

i = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
alice = a[0::2]
bob = a[1::2]
print(sum(alice) - sum(bob))
def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return (a * b) / gcd(a, b) 
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
print(int(ans))


### FIXED CODE ###

def gcd(a, b):
    if(a == 0):
        return b
    return gcd(b % a, a)
def lcm(a, b):
    return a // gcd(a, b) * b
t = int(input())
ans = 1
while(t != 0):
    t -= 1
    n = int(input())
    ans = lcm(ans, n)
print(int(ans))
n,m=map(int,input().split())
def hashh(x1,y1,x2,y2):
    if x1>x2:
        x1,y1,x2,y2=x2,y2,x1,y1
    if x1==x2 and y1>y2:
        x1,y1,x2,y2=x2,y2,x1,y1
    return x1*1021147343+y1*1014049+x2*1007+y2
abc_l=[list(map(int,input().split()))for _ in range(n)]
def_l=[list(map(int,input().split()))for _ in range(m)]
x=[0]
y=[0]
for a,b,c in abc_l:
    x.append(a)
    x.append(b)
    y.append(c)
for d,e,f in def_l:
    x.append(d)
    y.append(e)
    y.append(f)
x=sorted(list(set(x)))
y=sorted(list(set(y)))
h=len(x)+1
w=len(y)+1
dicx={}
dicy={}
for i in range(len(x)):dicx[x[i]]=i
for i in range(len(y)):dicy[y[i]]=i
grid=[[0]*w for _ in range(h)]
dont=set()
for a,b,c in abc_l:
    for i in range(dicx[a],dicx[b]):
        dont.add(hashh(i+1,dicy[c],i+1,dicy[c]+1))
for d,e,f in def_l:
    for j in range(dicy[e],dicy[f]):
        dont.add(hashh(dicx[d],j+1,dicx[d]+1,j+1))
if dicx[0]==0 or dicx[0]==h-1 or dicy[0]==0 or dicy[0]==w-1:
    exit(print("INF"))
stack=[(dicx[0],dicy[0])]
grid[dicx[0]][dicy[0]]=1
ans=(x[dicx[0]+1]-x[dicx[0]])*(y[dicy[0]+1]-y[dicy[0]])
for sx,sy in stack:
    for dx,dy in ((-1,0),(1,0),(0,-1),(0,1)):
        tx=sx+dx
        ty=sy+dy
        if grid[tx][ty]:continue
        if hashh(sx,sy,tx,ty) in dont:continue
        if tx==0 or tx==h-1 or ty==0 or ty==w-1:
            exit(print("INF"))
        grid[tx][ty]=1
        ans+=(x[tx+1]-x[tx])*(y[ty+1]-y[ty])
        stack.append((tx,ty))
print(ans)


### FIXED CODE ###

n,m=map(int,input().split())
def hashh(x,y,f):
    return (x*3000+y)*2+f
abc_l=[list(map(int,input().split()))for _ in range(n)]
def_l=[list(map(int,input().split()))for _ in range(m)]
x=[0]
y=[0]
for a,b,c in abc_l:
    x.append(a)
    x.append(b)
    y.append(c)
for d,e,f in def_l:
    x.append(d)
    y.append(e)
    y.append(f)
x=sorted(list(set(x)))
y=sorted(list(set(y)))
h=len(x)+1
w=len(y)+1
dicx={}
dicy={}
for i in range(len(x)):dicx[x[i]]=i
for i in range(len(y)):dicy[y[i]]=i
grid=[[0]*w for _ in range(h)]
dont=set()
for a,b,c in abc_l:
    for i in range(dicx[a],dicx[b]):
        dont.add(hashh(i+1,dicy[c],1))
for d,e,f in def_l:
    for j in range(dicy[e],dicy[f]):
        dont.add(hashh(dicx[d],j+1,0))
if dicx[0]==0 or dicx[0]==h-1 or dicy[0]==0 or dicy[0]==w-1:
    exit(print("INF"))
stack=[(dicx[0],dicy[0])]
grid[dicx[0]][dicy[0]]=1
ans=0
for sx,sy in stack:
    ans+=(x[sx]-x[sx-1])*(y[sy]-y[sy-1])
    for dx,dy in ((-1,0),(1,0),(0,-1),(0,1)):
        tx=sx+dx
        ty=sy+dy
        if grid[tx][ty]:continue
        if hashh(min(sx,tx),min(sy,ty),1 if sx==tx else 0) in dont:continue
        if tx==0 or tx==h-1 or ty==0 or ty==w-1:
            exit(print("INF"))
        grid[tx][ty]=1
        stack.append((tx,ty))
print(ans)
4
aaaa
a
aaa
aa


### FIXED CODE ###

n=int(input())
s=[]
for i in range(n):
    s.append(input())
    
print(len(set(s)))
n=int(input())
f1=list(map(int,input().split()))
c=0
for i in range(n-1):
    if f1[i]==i+1:
        c+=1
        f1[i],f1[i+1]=f1[i+1],f1[i]
if f[n-1]==n:
  	f[n-2],f[n-1]=f[n-1],f[n-2]
  	c+=1  
print(c)

### FIXED CODE ###

import copy

n=int(input())
f1=list(map(int,input().split()))
f2=copy.deepcopy(f1)
c=0
for i in range(n-1):
    if f1[i]==i+1:
        c+=1
        f1[i],f1[i+1]=f1[i+1],f1[i]

for i in range(n-1,0,-1):
    #print(d)
    if f1[i]==i+1:
        c+=1
        f1[i],f1[i-1]=f1[i-1],f1[i]

print(c)
S = input()
result = ''
for i in range(1, len(S)):
    s = S[0:len(S) - i]
	if len(s) % 2 == 0 and s[0:len(s)//2] == s[len(s)//2:]:
        result = len(s)
        break

print(result)


### FIXED CODE ###

# -*- coding: utf-8 -*-


def main():

    result = ''

    for i in range(1, len(S)):
        s = S[0:len(S) - i]

        if len(s) % 2 == 0 and s[0:len(s)//2] == s[len(s)//2:]:
            result = len(s)
            break

    print(result)


if __name__ == '__main__':
    S = input()
    main()
h,w,m=map(int, input().split())
a=[0]*m
hc=[0]*w
wc=[0]*h
for i in range(m):
	x,y=map(int, input().split())
	a[i]=[x-1,y-1]
	hc[y-1]+=1
	wc[x-1]+=1
hcm=max(hc)
wcm=max(wc)
hk=[0]*h
wk=[0]*w
for i in range(len(hc)):
	if hc[i]==hcm:
		hk[i]=1
for i in range(len(wc)):
	if wc[i]==wcm:
		wk[i]=1
c=0
for i in range(len(a)):
	if a[i][0]==wk[i] and a[i][1]==hk[i]:
		c+=1
if c==len(hk)*len(wk):
	print(hcm+wcm-1)		
else:
	print(hcm+wcm)

### FIXED CODE ###

h,w,m=map(int, input().split())
a=[0]*m
hc=[0]*w
wc=[0]*h
for i in range(m):
	x,y=map(int, input().split())
	a[i]=[x-1,y-1]
	hc[y-1]+=1
	wc[x-1]+=1
hcm=max(hc)
wcm=max(wc)
hk=[0]*w
wk=[0]*h
for i in range(len(hc)):
	if hc[i]==hcm:
		hk[i]=1
for i in range(len(wc)):
	if wc[i]==wcm:
		wk[i]=1
c=0
for i in range(len(a)):
	if wk[a[i][0]]==1 and hk[a[i][1]]==1:
		c+=1
if c==sum(hk)*sum(wk):
	print(hcm+wcm-1)		
else:
	print(hcm+wcm)
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

A,B,K = [int(x) for x in input().split()]
ls =[i in range(1,A+1) if A % i == 0 and B % i == 0]
print(ls[K])

### FIXED CODE ###

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

A,B,K = [int(x) for x in input().split()]
ls =[i for i in range(1,A+1) if A % i == 0 and B % i == 0]
ls.reverse()
answer = ls[K-1]
print(answer)
def lcs(x,y):
    xs = len(x)
    ys = len(y)
    x = " " + x
    y = " " + y
    c = [[0 for i in xrange(len(x))] for j in xrange(len(y))] 
 
 
    for i in xrange (1,ys+1):
        for j in xrange (1,xs+1):
            if x[j] == y[i]:
                a = 1
            else:
                a = 0
            c[i][j] = max(c[i][j-1],c[i-1][j],c[i-1][j-1] + a)
        m = max(m,c[i][j])
    return max(max(c))
 
n = input()
 
for i in xrange (n):
 
    x = raw_input()
    y = raw_input()
 
    print lcs(x,y)
    

### FIXED CODE ###

def lcs():
    x, y = raw_input(), raw_input()
    b1 = [0 for k in range(len(y)+1)]
    for i in xrange(len(x)):
        a = x[i]
        b2 = b1 + []
        for j in xrange(len(y)):
            if a == y[j]:
                b1[j+1] = b2[j] + 1
            elif b1[j+1] < b1[j]:
                b1[j+1] = b1[j]
    print max(b1)
 
n = input()
for i in xrange(n):
    lcs()
N = int(input())
S = input()
x = 0
max_x = 0
for c in S:
    if c == 'I': x += 1
    else: x -= 1
    max_x = max(max_x, x)
print(max_x)


### FIXED CODE ###

A, B, C, D = map(int, input().split())
print(max(A*B,C*D))
p=1
cnt=1
h,w,k=map(int,input().split())
for i in range(h):
	s=input()
	if s.count("#")==1:
		for j in range(w):
			a.append(p)
		p+=1
		for _ in range(cnt):
			print(*a)
		cnt=1
	elif s.count("#")==0:
		cnt+=1
	else:
		a=[]
		itigo=0
		for j in range(w):
			if s[j]=="#" and itigo==True:
				p+=1
				a.append(p)
			elif s[j]=="#":
				itigo=True
				a.append(p)
			else:
				a.append(p)
		for _ in range(cnt):
			print(*a)
		cnt=1
		p+=1
for i in range(cnt-1):
	print(*a)







### FIXED CODE ###

p=1
cnt=1
h,w,k=map(int,input().split())
for i in range(h):
	s=input()
	if s.count("#")==1:
		a=[]
		for j in range(w):
			a.append(p)
		p+=1
		for _ in range(cnt):
			print(*a)
		cnt=1
	elif s.count("#")==0:
		cnt+=1
	else:
		a=[]
		itigo=0
		for j in range(w):
			if s[j]=="#" and itigo==True:
				p+=1
				a.append(p)
			elif s[j]=="#":
				itigo=True
				a.append(p)
			else:
				a.append(p)
		for _ in range(cnt):
			print(*a)
		cnt=1
		p+=1
for i in range(cnt-1):
	print(*a)