Problem:


Score : 200 points

Problem Statement

We will call a string that can be obtained by concatenating two equal strings an even string.
For example, xyzxyz and aaaaaa are even, while ababab and xyzxy are not.

You are given an even string S consisting of lowercase English letters.
Find the length of the longest even string that can be obtained by deleting one or more characters from the end of S.
It is guaranteed that such a non-empty string exists for a given input.

Constraints

2 \leq |S| \leq 200

S is an even string consisting of lowercase English letters.

There exists a non-empty even string that can be obtained by deleting one or more characters from the end of S.

Input

Input is given from Standard Input in the following format:

S

Output

Print the length of the longest even string that can be obtained.

Sample Input 1

abaababaab

Sample Output 1

6

abaababaab itself is even, but we need to delete at least one character.

abaababaa is not even.

abaababa is not even.

abaabab is not even.

abaaba is even. Thus, we should print its length, 6.

Sample Input 2

xxxx

Sample Output 2

2

xxx is not even.

xx is even.

Sample Input 3

abcabcabcabc

Sample Output 3

6

The longest even string that can be obtained is abcabc, whose length is 6.

Sample Input 4

akasakaakasakasakaakas

Sample Output 4

14

The longest even string that can be obtained is akasakaakasaka, whose length is 14.



Sample input:
abaababaab


Sample output:
6

Submission status: Accepted

Solution code:
n = input()
num = len(n)-2
for i in range(num,0,-2):
  f = int(i/2)
  if n[:f]==n[f:i]:
    print(i)
    break

Submission status: Accepted

Solution code:
s=input()
m=0
if s[0]==s[1]:
    m=1
for i in range(1,len(s)//2):
    if i==len(s)//2-1:
        break
    if s[:i]==s[i:2*i]:
        m=i
print(2*m)

Submission status: Accepted

Solution code:
s = input()
num = len(s)-2
for i in range(num,0,-2):
  f = int(i / 2)
  if s[:f] == s[f:i]:
    print(i)
    break

Submission status: Accepted

Solution code:
#n = int(input())
#a, b = map(int,input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
s = input()
n = len(s)


def isrepeat(s):
    res = False
    n = len(s)
    if s[0:n//2]+s[0:n//2] == s:
        res = True
    return res


for delnum in range(1, n):
    if (n-delnum) % 2 == 0:
        if isrepeat(s[0:n-delnum]):
            ans = n-delnum
            break
print(ans)

Submission status: Accepted

Solution code:
s = input()

if len(s) % 2 == 1:
    s = s[:-1]
else:
    s = s[:-2]

while s[:len(s) // 2] != s[len(s) // 2:]:
    s = s[:-2]

print(len(s))

Submission status: Accepted

Solution code:
S=input()
S2=S[:(len(S))//2]
while len(S)>=2:
    S=S[:-2]
    S2=S2[:-1]
    if S==S2+S2:
        print(len(S))
        exit()

Submission status: Accepted

Solution code:
s = input()
s = s[:len(s) - 2]

while s[:len(s)//2] != s[len(s)//2:]:
    s = s[:len(s) - 2]
print(len(s))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    ans = 0
    s = input().rstrip('\n')
    ls = len(s)
    for i in range(1,ls):
        if (ls - i)%2 != 0:
            continue
        temps = s[:-i]
        if temps[:(ls-i)//2] == temps[(ls-i)//2:]:
            ans = ls - i 
            break

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    s = input()
    if len(s) % 2 == 0:
        i = len(s) - 2
    else:
        i = len(s) - 1
    while True:
        if s[:int(i/2)] ==  s[int(i/2):i]:
            print(i)
            break
        i -= 2
        


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
for i in range(1,len(S)):
    S_short = S[0:-i]
    if len(S_short)%2!=0:
        continue
    else:
        half = len(S_short)//2
        if S_short[0:half]==S_short[half:]:
            break
        else:
            continue
print(len(S)-i)

Submission status: Accepted

Solution code:
s = input()
n = len(s)
n -= 1
if n % 2:
    n -= 1
while n > 0:
    if s[:n//2] == s[n//2:n]:
        break
    n -= 2
print(n)

Submission status: Accepted

Solution code:
s = str(input())
while True:
    s = s[:-1]
    n = len(s) // 2
    if s[:n] == s[n:]:
        print(2 * n)
        exit()

Submission status: Accepted

Solution code:
n = input()[:-1]
while n[:len(n)//2] != n[len(n)//2:]:
  n = n[:-1]
print(len(n))

Submission status: Accepted

Solution code:
#4 B - ss
S = list(input())

def judge(A):
    if len(A)%2 == 0:
        if A[:len(A)//2] == A[len(A)//2:]:
            return True
    return False

for i in range(len(S)):
    S.pop()
    if judge(S):
        break
print(len(S))

Submission status: Accepted

Solution code:
s = str(input())
sl = list(s)
ans = 0
del sl[-1]
for i in range(1,len(sl)):
  if(len(sl)%2==0):
    if(sl[:len(sl)//2]==sl[len(sl)//2:]):
      ans = len(sl)
      break
  del sl[-1] 
print(ans)

Submission status: Accepted

Solution code:
S = input()
maxS = ""
for i in range(len(S)//2):
  tmp = S[:i]*2
  j = 2*i
  if tmp == S[:j]:
    maxS = tmp
print(len(maxS))

Submission status: Accepted

Solution code:
inp = list(input())

del inp[-1]

ans = 0
S = ""

for s in inp:
    S += s
    N = len(S)
    if N % 2 == 1:
        continue
    if S[:N // 2] == S[N // 2:]:
        ans = max(ans, N)

print(ans)

Submission status: Accepted

Solution code:
s=input()
while s:
  s=s[:-1]
  n=len(s)//2
  if s[:n]==s[n:]:
    print(2*n)
    break

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    cut = 1 if len(s)%2==1 else 2
    scut = s[:-cut]
    # print(scut)

    while scut[:len(scut)//2] != scut[len(scut)//2:]:
        cut += 2
        scut = s[:-cut]

    ans = len(scut)
    print(ans)


main()

Submission status: Accepted

Solution code:
s = input()
l = [s[:-i] for i in range(1,len(s)-1)]

for i in range(len(l)):
    half = len(l[i])//2
    if len(l[i]) % 2 == 0:
        if l[i][:half] == l[i][half:]:
            print(len(l[i]))
            exit()

Submission status: Accepted

Solution code:
s=input()
S=''.join(list(reversed(s)))
a=1
for i in range(len(S)):
    if (len(S)-a)%2==0:
        if S[a:(len(S)+a)//2]==S[(len(S)+a)//2:len(S)]:
            break
        else:
            a+=1
    else:
        a+=1
print(len(S)-a)

Submission status: Accepted

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

tar_index = len(s) - 1
count = 0

while (count < num):
    tar = s[:tar_index]
    tar_num = len(tar)
    # 文字数が奇数の時は、偶文字列にはならない。
    if (tar_num % 2 == 0):
        half = int(tar_num / 2)

        if (tar[:half] == tar[half:]):
            print(int(2 * len(tar[:half])))
            exit()
        else:
            pass

    else:
        pass

    tar_index -= 1
    count += 1

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


def check(s):
    if (s[len(s) // 2:] == s[:len(s) // 2]):
        print(len(s))
        exit()


S = S()
n = len(S)
if (n % 2 == 0):
    while S:
        S = S[:-2]
        check(S)
else:
    S = S[:-1]
    check(S)
    while S:
        S = S[:-2]
        check(S)

Submission status: Accepted

Solution code:
def is_gu(s):
    if s[0:len(s)//2] == s[len(s)//2:len(s)]:
        return True
    return False

S = input()
ans = len(S)-2

while True:
    if is_gu(S[0:ans]):
        break
    else:
        ans = ans-2

print(ans)

Submission status: Accepted

Solution code:
S=str(input())
for i in range(len(S)-1,0,-1):
    S=S[:i]
    if len(S)%2==0:
        x=len(S)//2
        if S[:x]==S[x:]:
            print(len(S))
            break

Submission status: Accepted

Solution code:
s = list(input())
ans = 0
if len(s)%2==0:
    s = s[:-2]
else:
    s.pop(-1)

while len(s)>0:
    if s[0:int(len(s)/2)]==s[int(len(s)/2):len(s)]:
        ans = len(s)
        break
    else:
        s = s[:-2]
        
print(ans)

Submission status: Accepted

Solution code:

S = input()
if len(S) %2 == 0 :
    S = S[:-2]
else :
    S =S[:-1]
while(1) :
    l = int(len(S)/2)

    if S[:l] == S[l:] :
        print(len(S))
        exit()
    S = S[:-2]

Submission status: Accepted

Solution code:
s = list(input())
s.pop(-1)
while len(s) > 0:
  if len(s) % 2 == 1:
    s.pop(-1)
    continue
  n = len(s)//2
  a = "".join(s[:n])
  b = "".join(s[n:])
  if a == b:
    print(len(s))
    exit()
  s.pop(-1)

Submission status: Accepted

Solution code:
s = input ()
while len(s) != 0:
  s = s[:-2]
  le = round (len(s)/2)
  if s[:le] == s[le:len(s)]:
    print (len(s))
    break

Submission status: Accepted

Solution code:
S = list(str(input()))
del S[-1]
del S[-1]

def ss(string):
    if len(string)&2==1:
        retrun(False)
    else:
        for i in range(len(string)//2):
            if S[i]!=S[len(string)//2+i]:
                return(False)
        return(True)

while True:
    if ss(S):
        print(len(S))
        exit()
    else:
        del S[-1]
        del S[-1]

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
S = input()

n = 0
for i in range(200):
    n += 2
    s = S[:len(S) - n]

    if s[: len(s) // 2] == s[len(s) // 2:]:
        print(len(s))
        exit()

Submission status: Accepted

Solution code:
S=input()
N=len(S)
for i in range((N-1)//2,0,-1):
  A=0
  for j in range(i):
    if S[j]!=S[j+i]:
      A=1
      break
  if A==0:
    print(2*i)
    break

Submission status: Accepted

Solution code:
S = input()
for i in range(len(S)):
    S = S[0:len(S)-1]
    if(len(S) % 2 == 0):
        if((S[0:(len(S)//2)]) == (S[(len(S)//2):len(S)+1])):
            print(str(len(S)))
            exit()

Submission status: Accepted

Solution code:
s = str(input())
for i in range(len(s)):
    s = s[:len(s)-1]
    if len(s)%2 == 0:
        a = s[:len(s)//2]
        b = s[len(s)//2:]
        if a == b:
            print(len(s))
            break

Submission status: Accepted

Solution code:
S = list(input())

S.pop(-1)
if (len(S)) % 2 == 1:
  S.pop(-1)
while True:
  count = 0
  for i in range(int(len(S)/2)):
    if S[i] == S[int(len(S)/2) + i]:
      count += 1
      continue
    else:
      break
  if count == len(S)/2:
    print(len(S))
    break
  S.pop(-1)
  S.pop(-1)

Submission status: Accepted

Solution code:
s = input()
while True:
    s = s[:-1]
    if s[0:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        exit()

Submission status: Accepted

Solution code:
S = input()
s = len(S)
i = 1
while True:
    _S = S[:-i]
    ls = len(_S)
    if _S[:ls//2] == _S[ls//2:]:
        break
    i += 1

print(s - i)

Submission status: Accepted

Solution code:
S = input()
s = S
for i in range(len(S)):
    s = s[:-1]
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        exit()

Submission status: Accepted

Solution code:
S = input()
for i in range(2, len(S), 2):
    if S[:(len(S)-i)//2] == S[(len(S)-i)//2:len(S)-i]:
        print(len(S)-i)
        exit()

Submission status: Accepted

Solution code:
S = input()
N = len(S)
ans = 0
for l in range(N//2+1):
    flag = True
    for i in range(l):
        if S[i] != S[i+l]:
            flag = False
            break
    if flag:
        if l*2 < N:
            ans = max(ans, l)
print(ans*2)

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    s = s_input()

    afeter_index = len(s) - 2
    
    while True:
        middle_index = afeter_index // 2

        tmp1 = s[:middle_index]
        tmp2 = s[middle_index:afeter_index]

        if tmp1 == tmp2:
            print(afeter_index)
            exit()
        
        afeter_index -= 2

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
cnt = 0
for i in range(2,len(s)-1,2):
    s_1 = s[:(len(s)-i)//2 ]
    s_2 = s[(len(s)-i)//2 :len(s)-i]
    
    if s_1 == s_2:
        print(len(s) - i)
        cnt = 1
        break
if cnt == 0:
    print(2)

Submission status: Accepted

Solution code:
def gumoji(moji):
    if len(moji)%2==0:
        if moji[:int(len(moji)/2)]==moji[-int(len(moji)/2):]:
            return True
    return False

s = str(input())
s = s[:len(s)-1]
#print(s)
while len(s)>=2:
    if gumoji(s):
        break
    else:
        s = s[:len(s)-1]
    
print(len(s))

Submission status: Accepted

Solution code:
s = list(input())[:-1]
while True:
  l = len(s)
  h = int(l / 2)
  if l % 2 == 0 and s[:h] == s[h:]:
    break
  s.pop()
print(l)

Submission status: Accepted

Solution code:
S = input()

len_S = len(S)
for i in range(1, len_S):
    if i % 2 == 0:
        tmp_S = S[:len_S - i]
        n_half = len(tmp_S) // 2
        S_l = tmp_S[:n_half]
        S_r = tmp_S[n_half:]
        if S_l == S_r:
            break
print(len(tmp_S))

Submission status: Accepted

Solution code:
S=input()
ans=0
S=S[:-1]
while True:
  t=len(S)
  if S[:t//2]==S[t//2:]:
    print(len(S))
    break
  S=S[:-1]

Submission status: Accepted

Solution code:
def check(s):
    l=len(s)
    if l%2 :
        return 0
    for i in range(l//2):
        if s[i]!=s[i+l//2]:
            return 0
    return 1        

s = input()
ans = 0
for i in range(1,len(s)):
    if check(s[:len(s)-i]) :
        ans = len(s)-i
        break
print(ans)

Submission status: Accepted

Solution code:
import re

S = input()
m = re.search(r'\A([a-z]+)\1', S[:len(S) - 1])
print(len(m.group(0)))

Submission status: Accepted

Solution code:
S = input().strip()
l=len(S)
ans=0
for i in range(0, l-1):
    if i%2==1:
        f=0
        for j in range((i-1)//2):
            if S[j+((i-1)//2)+1]!=S[j]:
                f+=1
        if f<=0:
            ans=i+1
print(ans)

Submission status: Accepted

Solution code:

def check(s: str) -> bool:
    ls = len(s)
    if ls % 2 != 0:
        return False
    else:
        if "".join(s[:ls//2]) == "".join(s[ls//2:]):
            return True


s = input()
l = len(s)
ans = 0
for i in reversed(range(l-1)):
    if check(s[0:i + 1]):
        ans = i+1
        break

print(ans)

Submission status: Accepted

Solution code:
S=input()[:-1]

def is_even(seq):
  return seq[:len(seq)//2]==seq[len(seq)//2:]

for i in range(len(S)):
  s = S[:len(S)-i]
  if len(s)%2==0 and is_even(s):
    print(len(s))
    exit()

Submission status: Accepted

Solution code:
def isEvenStr(s):
  if len(s) % 2 == 1:
    return False
  elif s[0:int(len(s)/2)] == s[int(len(s)/2):]:
    return True
  else:
    return False

s = input()
l = len(s)
i = 0

while not isEvenStr(s) or i == 0:
  s = s[:-1]
  i += 1
  if isEvenStr(s):
    print(l - i)

Submission status: Accepted

Solution code:
S = input()

S = S[:-1]

if len(S) % 2 == 1:
    S = S[:-1]

while True:
    half = len(S) // 2 
    if S[:half] == S[half:]:
        print(len(S))
        exit()

    S = S[:-2]

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
lens = len(s)
for i in range(2, lens, 2):
  if s[:(lens - i) // 2] == s[(lens - i) // 2:lens - i]:
    print(lens - i)
    exit()

Submission status: Accepted

Solution code:
S = input()
N = len(S)
for i in range(len(S)):
    S = S[0:-1]
    if len(S)%2 == 0:
        if S[0:len(S)//2] == S[len(S)//2:len(S)]:
            ans = i+1
            break
    else:
        pass
print(N - ans)

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

s = input()

while True:
    s = s[:-2]
    if s[0:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        exit()

Submission status: Accepted

Solution code:
def solve():
    S = input()
    for _ in range(len(S)):
        S = S[:-2]
        if S[:len(S) // 2] == S[len(S) // 2:]:
            print(len(S))
            exit()


if __name__ == "__main__":
    solve()

Submission status: Accepted

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


def main():
    s = input()
    l = len(s)
    ans = l - 2
    for i in range(2, l):
        if i % 2 != 0: continue
        ns = s[:l-i]
        even = True
        for j, c in enumerate(ns):
            if j >= (l - i) // 2: break
            if c != ns[(l - i) // 2 + j]:
                even = False
                break
        if even:
            ans = l - i
            break
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s=input()
n=len(s)
for i in range(1,n//2):
    if s[0:(n-2*i)//2] == s[(n-2*i)//2:n-2*i]:
        print(len(s[0:(n-2*i)//2])*2)
        exit()

Submission status: Accepted

Solution code:
s=input()
n=len(s)
for i in range(1,n//2-1):
    m=n//2-i

    x=s[0] 
    for j in range(m-1):
        x=x+s[j+1]
    y=s[m]
    for j in range(m-1):
        y=y+s[m+1+j]

    if x==y:
        print(2*m)
        exit()
print(2)

Submission status: Accepted

Solution code:
s = input()

ans = 0
for i in range(1, len(s)):
  tmp_s = s[: - i]
  tmp_N = len(tmp_s)
  if tmp_N % 2 == 1:
    continue
  tmp_s_l = tmp_s[:tmp_N//2]
  tmp_s_r = tmp_s[tmp_N//2:]
  if tmp_s_l == tmp_s_r:
    ans = tmp_N
    break

print(ans)

Submission status: Accepted

Solution code:
s=input()
for i in range(2,len(s)-1,2):
    s=s[:-2]
    if s[:len(s)//2]==s[len(s)//2:]:print(len(s));exit()

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    for i in range(len(S)-1):
        S = S[:-1]
        if len(S)%2 == 0 and S[:len(S)//2] == S[len(S)//2:]:
            print(len(S))
            exit()
resolve()

Submission status: Accepted

Solution code:
s=input()
for i in range(len(s)-1, 1, -1):
    t=s[:i]
    l=len(t)
    if l%2!=0:
        continue
    if t[:l//2]==t[l//2:]:
        print(l)
        exit()

Submission status: Accepted

Solution code:
s=list(input())
for i in range(len(s)):
  del s[-1]
  if len(s)%2==0:
    if s[:len(s)//2] == s[len(s)//2:]:
      break
    else:
      pass
  else:
    pass
print(len(s))

Submission status: Accepted

Solution code:
s = input()
if len(s) % 2 == 1:
    s += "."

for i in range(2, len(s), 2):
    if (s[:(len(s)-i)//2]*2 == s[:len(s)-i]):
        print(len(s)-i)
        break

Submission status: Accepted

Solution code:
s = input()

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

while(s != ""):
    l = len(s)//2
    if(s[:l] == s[l:]):
        print(l*2)
        break
    s = s[:-2]

Submission status: Accepted

Solution code:
s = input()

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

while(s != ""):
    if(s[:len(s)//2] == s[len(s)//2:]):
        print(len(s))
        break
    s = s[:-2]

Submission status: Accepted

Solution code:
l = list(input())
while len(l) > 0:
    l = l[:-2]
    if l[:len(l)//2] == l[len(l)//2:]:
        print(len(l))
        exit()

Submission status: Accepted

Solution code:
s=input()
for i in range(2,len(s),2):
    x=s[:-i]
    leng=len(x)
    if x[:leng//2] == x[leng//2:]:
        print(leng)
        break

Submission status: Accepted

Solution code:
S = input()
ans = 0
for i in range(1,len(S)//2):
    if str(S[0:i]) == str(S[i:i*2]):
        ans = i * 2
print(ans)

Submission status: Accepted

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


def main():
  S = input()[:-1]

  dl = 2
  while dl < len(S):
    center = (len(S) - dl) // 2
    if S[:center] == S[center:-dl]:
      print(len(S)-dl)
      return
    dl += 2


if(__name__ == '__main__'):
  main()

Submission status: Accepted

Solution code:
S = input()[:-1]

while S[:len(S)//2] != S[len(S)//2:]:
    S = S[:-1]

print(len(S))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    S = input()

    ans = 0
    for i in range(len(S)):
        S_tmp = S[:-i-1]
        if len(S_tmp)%2 != 0:
            continue
        ci = len(S_tmp)//2
        if S_tmp[:ci] == S_tmp[ci:]:
            ans = max(ans, len(S_tmp))
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = str(input())
for i in range(len(s)):
    s=s[:-2]
    if s[:len(s)//2] ==s[len(s)//2:]:
        print(len(s))
        break

Submission status: Accepted

Solution code:
s = input()

end = len(s) - 1
half = int(len(s) / 2) - 1
flag = True
while end != 1:
    end -= 2
    half -= 1
    start = 0
    flag = True
    for i in range(half+1, end):
        if s[i] != s[start]:
            flag = False
            break
        start += 1
    if flag == True:
        print(end+1)
        exit()

Submission status: Accepted

Solution code:
S = input()

n = len(S)
m = n // 2 if n % 2 == 1 else n//2 - 1

for w in range(m,0,-1):
    for i in range(w):
        if S[i] != S[i+w]:
            break
    else:
        print(2*w)
        break

Submission status: Accepted

Solution code:
S = input()

start = 2
if len(S) % 2:
    start = 1

for i in range(start,len(S),2):
    t = S[:-i]
    n = len(t) // 2
    if t[:n] == t[n:]:
        print(len(t))
        break

Submission status: Accepted

Solution code:
S = input()

N = len(S)

for i in range(N-2, 0, -2):
    h = i // 2
    if S[:h] == S[h:i]:
        
        print(i)
        break

Submission status: Accepted

Solution code:
S = str(input())
N = len(S)
for i in range(1,N):
  T = S[:N-i]
  M = len(T)
  if M%2 != 0:
    continue 
  if T[:M//2] == T[M//2:]:
    print(M)
    exit()

Submission status: Accepted

Solution code:
S = input().strip()
cnt = 0
for i in range(len(S)-3,-1,-2):
    if S[:(i+1)//2]==S[(i+1)//2:i+1]:
        cnt = (i+1)
        break
print(cnt)

Submission status: Accepted

Solution code:
s = list(input())
s = s[:-1]

while len(s)%2!=0 or s[:len(s)//2]!=s[len(s)//2:]:
    s = s[:-1]
print(len(s))

Submission status: Accepted

Solution code:
import math
S = str(input())
S=S[0:len(S)-1]
 
if len(S)%2!=0:
	S=S[0:len(S)-1]
 
for i in range (0, int(len(S)/2)):
	N = len(S)
	if S[0:int(N/2)] == S[int(N/2)::]:
		print(2*len(S[0:int(N/2)]))
		exit()	
	else:
		S=S[0:N-2]

Submission status: Accepted

Solution code:
s = input()
s = s[:-2]
while s[:len(s)//2] != s[len(s)//2:]:
  s = s[:-2]
print(len(s))

Submission status: Accepted

Solution code:
S = input()[:-1]
ans = 0

for i in range(len(S)):
    if S[:len(S)//2] == S[len(S)//2:]:
        ans = len(S)
        break
    else:
        S = S[:-1]
print(ans)

Submission status: Accepted

Solution code:
S = input()
for T in range(len(S)-2,0,-2):
    if S[:T//2]==S[T//2:T]:
        print(T)
        break

Submission status: Accepted

Solution code:
S = input()
N = len(S) // 2
for i in reversed(range(N)):
  if S[0:i] == S[i:2*i]:
    print(2*i)
    break

Submission status: Accepted

Solution code:
s = input()
ans =0
n = len(s)
for i in range(1 , n):
	f=0
	for j in range(0 , i-1):
		if j+i>=n or s[j]!=s[i+j]:
			f=1
	if f==0:
		if n-2*i!=0:
			ans = max(ans, 2*i)
print(ans)

Submission status: Accepted

Solution code:
s = input()
l = len(s)
for i in range(l):
    val = (l-i-1)
    if not val%2:
        sol = s[:val]
        if sol[:val//2]==sol[val//2:]:
            print(val);    break

Submission status: Accepted

Solution code:
s = input()

for i in range(len(s)-2, 0, -2):
    if s[:i//2] == s[i//2:i]:
        print(len(s[:i]))
        break

Submission status: Accepted

Solution code:
S = input()
for i in range(2, len(S), 2):
    if S[:(len(S)-i)//2] == S[(len(S)-i)//2:len(S)-i]:
        print(len(S)-i)
        break

Submission status: Accepted

Solution code:
s = input()

l = len(s)

if l%2 ==1: #偶数にする
    s = s[:-1]
else:
    s = s[:-2]



for i in range(l):
    l = len(s)
    lh = int(l/2)
    if s[:lh] == s[lh:]:
        break
    s = s[:-2]
    
print(len(s))

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    N = len(S)

    for w in range(N // 2 - 1, 0, -1):
        ok = True
        for i in range(w):
            if S[i] != S[i + w]:
                ok = False
                break
        if ok:
            print(2 * w)
            return

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def is_even(S):
    if len(S) % 2 != 0:
        return False
    if S[: len(S) // 2] == S[len(S) // 2 :]:
        return True
    else:
        return False


def main():
    S = readline().strip()
    S = S[:-1]

    for w in range(len(S), 0, -1):
        for i in range(len(S) - w + 1):
            if is_even(S[i : i + w]):
                print(w)
                return

    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()
n=len(s)//2
 
for i in range(1,n):
  if s[:n-i]==s[n-i:2*n-2*i]:
    print(2*n-2*i)
    break

Submission status: Accepted

Solution code:
s=input()
ls=len(s)
for i in range(2,ls+1,+2):
  ss=s[:ls-i]
  if ss[:len(ss)//2] == ss[len(ss)//2:]:
    print(len(ss))
    exit()

Submission status: Accepted

Solution code:
s = input()
len_s = len(s)
is_ok = False
while(is_ok == False):
    len_s -= 2
    word = s[:len_s]
    if word[:len_s // 2] == word[len_s // 2 :]:
        is_ok = True
    else:
        pass
print(len_s)

Submission status: Accepted

Solution code:
s = input()

if len(s) == 2:
  print(0)
else:
  for l in range(1,len(s)):
    s = s[:len(s)-1]
    if s[:len(s)//2] == s[len(s)//2:]:
      print(len(s))
      break

Submission status: Accepted

Solution code:
S=list(input())
while len(S)!=0:
    S.pop()
    if len(S)%2==0 and S[:len(S)//2]==S[len(S)//2:]:
        print(len(S))
        break

Submission status: Accepted

Solution code:
def solve():
  ans = 0
  S = input()
  n = len(S)
  for i in range(n//2-1,0,-1):
    if S[:i]==S[i:2*i]:
      return i*2
print(solve())

Submission status: Accepted

Solution code:
# 2020/07/26
# AtCoder Beginner Contest 066 - B
# B:後ろから順に消して全探索
# 2文字ずつ消す

# Input
s = list(input())
n = len(s)

# Calc
for i in range(n-1, 0, -1):
    s.pop()
    slen = len(s)
    # 偶数時のみ実施
    if slen % 2 == 0:
        hs = slen // 2
        tflg = True
        for j in range(0, hs, 1):
            if s[j] != s[j+hs]:
                tflg = False
                break
        if tflg == True:
            ans = slen
            break

# Output
print(ans)

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
S = input()[:-1]
while len(S):
    if S[:len(S)//2] == S[len(S)//2:]:
        print(len(S))
        exit()
    S = S[:-1]

Submission status: Accepted

Solution code:
S = input().strip()
N = len(S)
for i in range(1,N-1):
    if (N-i)%2==0 and S[:(N-i)//2]==S[(N-i)//2:N-i]:
        print(N-i)
        break

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


S = ins()


def is_even(s):
    if len(s) % 2 == 1:
        return False
    k = len(s) // 2
    for i in range(k):
        if s[i] != s[k + i]:
            return False
    return True


def solve():
    for i in range(len(S) - 1, 1, -1):
        s = S[:i]
        if is_even(s):
            return i
    return None


print(solve())

Submission status: Accepted

Solution code:
s = input()
s = s[:-1]
while len(s)%2!=0 or s[:len(s)//2]!=s[len(s)//2:]:
    s = s[:-1]
print(len(s))

Submission status: Accepted

Solution code:
s = list(str(input()))
for i in range(len(s)):
    s.pop()
    if len(s)%2 == 1:
        continue
    t = s[0:len(s)//2]
    u = s[len(s)//2:]
    t = ''.join(t)
    u = ''.join(u)
    if t == u:
        print(len(s))
        exit()