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:
S = input()
l = len(S)
cnt = 0
for i in range(1, 101):
    cnt += 2
    if S[0:l//2-i] == S[l//2-i:l-2*i]:
        print(l-cnt)
        break

Submission status: Accepted

Solution code:
S = input()

while True:
  S = S[:-1]
  if len(S) % 2 ==1:
    continue
  elif S[0:len(S)//2] == S[len(S)//2:]:
    print(len(S))
    break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
while len(s) > 0:
    s = s[:-2]
    n = len(s)  # length is supposed to be even
    center_index = n // 2
    former = s[:center_index]
    latter = s[center_index:]
    if former == latter:
        print(n)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def func(s):
    n = len(s)//2
    left = s[:n]
    right = s[n:]
    if left == right:
        return True
    else:
        return False

s = list(input())
m = len(s)
for i in range(2,m,2):
    if func(s[:m-i]):
        print(m-i)
        break

Submission status: Accepted

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

trial=(n-1)//2
for i in range(trial):
  half=trial-i
  if s[:half]==s[half:2*half]:
    print(half*2)
    break

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
s = input()[:-1]
n = len(s)
for i in reversed(range(1, n, 2)):
    left = s[: i // 2 + 1]  
    right = s[i // 2 + 1: i + 1]  
    # print("left =", left)
    # print("right =", right)
    if left == right:
        print(i + 1)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = [i for i in input()]
#print(s[:-2])
s = s[:-2]
while not s[:len(s)//2] == s[len(s)//2:]:
    s = s[:-2]
print(len(s))

Submission status: Accepted

Solution code:
S=input()
n=len(S)
for i in range(2,n-2+1,2):
  m=int((n-i)/2)
  SF=S[0:m]
  SR=S[m:m*2]
  if SF==SR:
    #print(SF,SR)
    print(len(SF+SR))
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=[i for i in input()]
n=len(S)
for i in range(2,n-2+1,2):
  m=int((n-i)/2)
  SF=S[0:m]
  SR=S[m:m*2]
  if SF==SR:
    #print(SF,SR)
    print(len(SF+SR))
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    S = input()
    while True:
        S = S[:-2]
        if S[:len(S)//2] == S[len(S)//2:]:
            print(len(S))
            return



if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
s=list(input())

while True:
    s.pop()
    l=len(s)
    if l%2==0 and s[0:l//2]==s[l//2:] :
        print(l)
        exit()

Submission status: Accepted

Solution code:
s = input()

while True:
    s = s[:-1]
    n = len(s)
    if n%2==1:
        continue
    if s[:n//2]==s[n//2:]:
        print(n)
        exit()

Submission status: Accepted

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

ans = None
for i in range(1,L):
  if (L - i) % 2 != 0:
    continue
  ns = S[:-i]
  h = (L - i) // 2
  m = ns[:h] + ns[:h]
  if ns == m:
    ans = ns
    break
    
print(len(ans))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    S = input()

    while len(S) > 1:
        S = S[:-2]
        mid = len(S)//2
        left = S[:mid]
        right = S[mid:]
        if left == right:
            print(len(S))
            return


main()

Submission status: Accepted

Solution code:
#ABC066-B
def gusu(s):
    l = len(s)
    if l % 2 == 0:
        s_1 = s[:(l//2)]
        s_2 = s[(l//2):]
        if s_1 == s_2:
            return True
        
    return False

s = input()

for i in range(len(s),-1,-1):
    tmp = s[:]
    tmp = tmp[:i-1]
    if gusu(tmp):
        print(len(tmp))
        break

Submission status: Accepted

Solution code:
S = input()

def is_even_string(string):
    # print("str1: {}, str2: {}".format(string[:len(string)//2], string[len(string)//2:]))
    if string[:len(string)//2] == string[len(string)//2:]:
        return True
    else:
        return False

for i in range(2, len(S), 2):
    new_S = S[:len(S)-i]
    # print("new_S: {}".format(new_S))
    if is_even_string(new_S):
        print(len(new_S))
        exit(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

for i in range(1, len(S)-1):
    s = S[:-i]
    if len(s)%2 == 0 and s[:len(s)//2] == s[len(s)//2:]:
        ans = len(s)
        break

print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
def myAnswer(S:list) -> int:
   ans = 0
   for i in range(len(S)):
      S.pop() # 末尾消去
      if(len(S) % 2 == 1):
         continue
      middle = len(S) // 2
      if(S[middle:] == S[:middle]):
         ans = len(S)
         break
   return ans





def modelAnswer():
   tmp=1
def main():
   S = list(input())
   print(myAnswer(S[:]))
if __name__ == '__main__':
   main()

Submission status: Accepted

Solution code:
S=input().rstrip()
L=l=len(S)
ans=0
for i in range(L-2,-1,-1):
  l-=1
  if l%2==1:
    continue
  f=True
  m=l//2
  for j in range(0,m):
    if S[j]!=S[m+j]:
      f=False
      break
  if f:
    ans=i+1
    break
print(ans)

Submission status: Accepted

Solution code:
s = list(str(input()))

s_rev = list(reversed(s))
n = len(s_rev)

for i in range(n):
  del s_rev[0]
  if len(s_rev) % 2 == 1:
    continue
  elif s[0:len(s_rev)// 2] != s[(len(s_rev) // 2):len(s_rev)]:
    continue  
  elif len(s_rev) != 0:
    print(len(s_rev))
    break

Submission status: Accepted

Solution code:

s = input()
if len(s) % 2 == 0:
    flag = 1
else:
    flag = 0

def search_ss(s, flag):
    for i in range(len(s) - 1 - flag, -1, -2):
        judge = True
        for j in range(i // 2):
            if s[j] != s[i // 2 + j]:
                judge = False
                break
        if judge == True:
            print(i)
            exit()

search_ss(s, flag)

Submission status: Accepted

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

  if l[:(n-i)//2] == l[(n-i)//2:] or r[:(n-i)//2] == r[(n-i)//2:]:
    print(n-i)
    break

Submission status: Accepted

Solution code:
S = input()
if len(S) % 2 == 1:
    S = S[-1]
for i in reversed(range(2, len(S) + 1, 2)):
    length = i
    fl = 0
    for j in range(i // 2):
        # print(S[j], S[j + length // 2])
        if S[j] != S[j + length // 2]:
            fl = 1
    if fl == 0 and length != len(S):
        print(length)
        exit()

Submission status: Accepted

Solution code:
s = input()
s = s[:-1]
while True:
    num = len(s)
#    print(s,s[:num//2],s[num//2:])
    if num%2 == 0 and s[:num//2] == s[num//2:]:
        print(len(s))
        exit()
    else:
        s = s[:-1]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
for i in range(2, len(S), 2):
    s = S[0:-i]
    mid_s = int(len(s) / 2)
    s_1 = s[:mid_s]
    s_2 = s[mid_s:]
    if s_1 == s_2:
        ans = len(s_1) * 2
        break
print(ans)

Submission status: Accepted

Solution code:
def IsEvenString(sl):
    Nsl = len(sl)
    if Nsl%2 is not 0:
        return False
    else:
        if sl[:Nsl//2] == sl[-Nsl//2:]:
            return True
        else:
            return False

S = input()

LS = len(S)
i = LS%2
j = LS // 2
N = 0
for k in range(1,j):
    # print(S[:LS-2*k+i])
    if IsEvenString(S[:LS-2*k+i]):
        N = LS-2*k+i
        break

# print(IsEvenString(S))
print(N)

Submission status: Accepted

Solution code:
S=input()
A = ""
B = ""
if len(S)%2 == 0:
    N = len(S)//2-1
else : N = len(S)//2
while True:
    for i in range(N):
        A += S[i]
        B += S[i+N]
    if A == B:
        print(len(A)*2)
        break
    else:
        N -= 1
        A = ""
        B = ""

Submission status: Accepted

Solution code:
S = input()

for i in range(200):
  S = S[:len(S)-1]
  if S[len(S)//2:]==S[:len(S)//2]:
    print(len(S))
    exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc066/tasks/abc066_b
s = input()

while True:
    s = s[:-1]
    if len(s) % 2 == 1:
        continue
    mid = len(s) // 2
    if s[:mid] == s[mid:]:
        print(len(s))
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

def checkss(str):
    ntemp=int(len(str)/2)
    a=str[0:ntemp]
    b=str[ntemp:]
    if a==b:
        return ntemp*2
    else:
        return -1

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
f = True
while f:
    s = s[:len(s) - 2]
    if s[:len(s) // 2] == s[len(s) // 2:]:
        print(len(s))
        f = False

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
s.pop(-1)
for i in range(len(s)):
    if len(s) % 2 == 0:
        if s[:len(s)//2] == s[len(s)//2:]:
            print(len(s))
            exit()
    s.pop(-1)

Submission status: Accepted

Solution code:
s_l = list(input())

for i in range(1,len(s_l)):
    s_l2 = s_l[:-i]
    if len(s_l2)%2 != 0:
        continue
    for j in range(len(s_l2)//2):
        if s_l2[j] != s_l2[j+len(s_l2)//2]:
            find = False
            break
        find = True
    if find:
        break

print(len(s_l2))

Submission status: Accepted

Solution code:
s = list(input())

def even_str(s):
    if len(s)%2 != 0:
        return False
    elif s[:len(s)//2] == s[len(s)//2:]:
        return True
    else:
        return False
for i in range(2, len(s), 2):
    if even_str(s[:-i]):
        print(len(s)-i)
        break

Submission status: Accepted

Solution code:
s = input()
lst = []
for i in range(len(s)):
    text = s[0:-i]
    
    if len(text)%2==0 and len(text)!=0:
        n = len(text)//2
        if text[:n] == text[n:]:
            lst.append(len(text))
print(max(lst))

Submission status: Accepted

Solution code:
s=input()

x=0
for i in range(len(s)):
    s=s[:len(s)-1]
    x+=1
    if len(s)%2==0 and s[0:len(s)//2]==s[len(s)//2:len(s)]:
        break

print(len(s))

Submission status: Accepted

Solution code:
S = input().strip()
n = len(S)

for i in range(n-2, 0, -2):
  S = S[:i]
  k = i // 2
  if S[k:] == S[:k]:
    print(i)
    exit()

Submission status: Accepted

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

for i in range(1,L):
    l = (L // 2 - i)
    if s[0:l] == s[l:L - 2 * i]:
        ans = l * 2
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

while True:
    s.pop()
    s.pop()
    
    len_s = len(s)
    
    if s[:len_s//2] == s[len_s//2:]:
        print(len_s)
        break

Submission status: Accepted

Solution code:
def resolve():
    s = input()
    l = len(s)
    for i in range(2, l, 2):
        test = s[0:(l-i)]
        t = len(test)
        if test[0:(t//2)] == test[(t//2):t]:
            print(len(test))
            exit()
resolve()

Submission status: Accepted

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

while True:
    l=len(s)//2
    s0=s[:l]
    s1=s[l:]
    if s0==s1:
        print(l*2)
        exit()
    else:
        s=s[:-2]
        #print(s)

Submission status: Accepted

Solution code:
lis=list(input())
lislen=len(lis)
ma=0
for a in range(1,(len(lis)-1)//2+1):
    if lis[0:a]==lis[a:a+a]:
        ma=a*2
print(ma)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
c = len(s) -2

for i in range(c,0,-1):
    lst = [x for idx, x in enumerate(s) if idx <= i]
    for ix in range(1, len(lst)+1):
        if lst[0:ix] == lst[ix:len(lst)]:
            print(len(lst))
            break
    else:
        continue
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
ans = 0
for i in range(len(s)):
    s.pop()
    if len(s)%2==1:
        continue
    else:
        i = 0
        while i < len(s)//2:
            if s[i]!=s[i+len(s)//2]:
                break
            
            if i==len(s)//2-1:
                ans = len(s)
            
            i += 1
        if ans > 0:
            break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def guumojiretu(s):
    num = len(S)
    if S[:num // 2] == S[num//2:]:
        return True
    return False
S = input()
S = S[:-1]
while True:
    if guumojiretu(S):
        break
    S = S[:-1]
print(len(S))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

while True:
    s.pop()
    s.pop()
    
    lenght = len(s)
    
    if s[:lenght//2] == s[lenght//2:]:
        print(lenght)
        break

Submission status: Accepted

Solution code:
S = input()
L = (len(S)-1)//2*2
for l in range(L,0,-2):
    if S[:l//2] == S[l//2:l]:
        print(l)
        exit()

Submission status: Accepted

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

def f():
    for erase in range(1, N + 1):
        new = S[0 : N - erase]
        if len(new) % 2 == 1: continue
        flg = 1
        for i in range((N - erase) // 2):
            if new[i] != new[(N - erase) // 2 + i]: 
                flg = 0
                break
        if not flg: continue
        return len(new)

print(f())

Submission status: Accepted

Solution code:
S = list(input())
N = len(S)
for i in range(N-1):
  S.pop(len(S)-1)
  n = len(S)
  if S[:n// 2] == S[n//2:]:
    break
print(n)

Submission status: Accepted

Solution code:
S=input()
for n in range(2-(len(S)&1), len(S), 2):
    m = (len(S)-n)//2
    for i in range(m):
        if S[i] != S[i+m]: break
    else:
        print(m*2)
        exit()

Submission status: Accepted

Solution code:
def resolve():
  s = input()
  ans = ""

  for i in range(1, len(s) // 2):
    a = s[0:i]
    b = s[i:2*i]
    if a == b:
      ans = len(a) + len(b)

  print(ans)
  return

if __name__ == "__main__":
  resolve()

Submission status: Accepted

Solution code:
s = list(str(input()))
n = len(s)

for i in range(n):
    s.pop()
    #print(s)
    #print(s[0:n//2], s[n//2:])
    if s[0:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        exit()

Submission status: Accepted

Solution code:
s = list(input())
ans = 0
for i in range(2,len(s), 2):
    if s[0:i//2] == s[i//2:i]:
        ans = i
print(ans)

Submission status: Accepted

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

    n = len(s)
    for i in range(n // 2):
        s = s[:-2]
        if s[0:n//2-i-1] == s[n//2-i-1:n-i*2-2]:
            print(n-i*2-2)
            return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input()
ans = 0
for i in range(len(s)):
        t = s[:i]
        if t[:i//2]*2==t: ans = i
print(ans)

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    S = input().strip("\n")
    lenS = len(S)
    for i in range(1, lenS//2):
        if S[:(lenS - 2 * i) // 2] == S[(lenS - 2 * i)// 2: lenS - 2 * i]:
            print(lenS - 2 * i)
            break

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def main():
    S = [s for s in input()]
    N = len(S)
    S.pop()
    S.pop()
    N -= 2
    while S and S[:N//2] != S[N//2:]:
        S.pop()
        S.pop()
        N -= 2
    print(N)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def judge(S):
    n = len(S)
    if n % 2 == 0 and S[:n//2] == S[n//2:]:
        return True
    else:
        return False


S = input()
S = S[:-1]
while not judge(S):
    S = S[:-1]
print(len(S))

Submission status: Accepted

Solution code:
def solve():
    s = input()
    for i in range(2,len(s)):
        ed = len(s)-i
        mid = ed//2
        if s[:mid] == s[mid:ed]:
            print(len(s[:ed]))
            return
if __name__=='__main__':
    solve()

Submission status: Accepted

Solution code:
S = input()

for i in range(1, len(S)):
    if i % 2 > 0: continue
    ans = None
    for j in range((len(S) - i) // 2):
        if S[j] == S[j + (len(S) - i) // 2]:
            continue
        else:
            break
    else:
        ans = len(S) - i
    #
    if ans != None: break

print(ans)

Submission status: Accepted

Solution code:
s = input()
for i in range(len(s)):
    a = len(s[:~i])
    if a%2 == 0 and s[:~i][:a//2]==s[:~i][a//2:]:
        print(a)
        break

Submission status: Accepted

Solution code:
def resolve():
    '''
    code here
    '''
    S = input()
    N = len(S)
    res = 0
    for i in range(N//2):
        a = S[:i]
        b = S[i:2*i]
        if a == b:
            res = max(i,res)

        # print(a, b)

    print(res*2)
if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = [i for i in input()]
while True:
    S.pop(-1)
    if len(S)%2==0:
        s = ''.join(S)
        s1 = s[:(len(S)//2)]
        s2 = s[len(S)//2:]
        if s1 == s2:
            print(len(S))
            exit(0)
    elif len(S)==0:
        print(0)
        exit(0)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

s = read().rstrip().decode()
for check in range(len(s) - 2, -1, -2):
    if s[check // 2:check] == s[:check // 2]:
        print(check)
        exit()

Submission status: Accepted

Solution code:
S = list(input())

for i in range(len(S)):
    del S[-1]
    if len(S) % 2 ==0:
        for j in range(len(S)//2):
            if S[j] == S[j+len(S)//2]:
                if j == len(S)//2-1:
                    print(len(S))
                    exit()
            else:
                break

Submission status: Accepted

Solution code:
data = input()
for _ in range(len(data)):
    data = data[:-1]
    count = len(data)
    if data[:count//2] == data[count//2:]:
        print(count)
        break

Submission status: Accepted

Solution code:
list_S = list(input())
n = len(list_S)
ans = 0
for i in range(n):
    list_S.pop(-1)
    for j in range(1, n-i):
        if "".join(list_S[:j]) == "".join(list_S[j:]):
            k = 2*j
            ans = max(ans, k)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

for i in range(1,len(s)):
  x = s[:-i]
  if len(x)%2 !=0:
    continue
  else :
    a = x[:len(x)//2]
    b = x[len(x)//2:]
    if a ==b :
      print(len(x))
      exit()

Submission status: Accepted

Solution code:

url = "https://atcoder.jp//contests/abc066/tasks/abc066_b"

def main():
    pat = input()
    for i in range(len(pat) - 1, 0, -1):
        ind = i // 2
        a = ''.join(pat[:ind])
        b = ''.join(pat[ind:i:])
        if a == b:
            print(i)
            exit()
    print(1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
L = len(S)
n = 0

for i in range(L):
  if (L - (i + 1)) % 2 == 0:
    M = int((L - i - 1) / 2)
    if S[:M] == S[M:L-1-i]:
      n = L-1-i
      break
print(n)

Submission status: Accepted

Solution code:
st=input()
for i in range(1,len(st)+1):
    t=st[:-i]
    if len(t)%2==0 and t[0:len(t)//2]==t[len(t)//2:]:
        print(len(t))
        break

Submission status: Accepted

Solution code:
N = str(input())
#print(N)
len(N)

#１文字削る
N = N[:len(N)-1]

#条件式　文字列の長さが偶数かどうか
#偶数でなければ1文字削る
while True:        
    if len(N) % 2 != 0:
#        print(N)
        N = N[:len(N)-1]
 #       print(N)
    else:
        N1 = N[:len(N)//2]
        N2 = N[len(N)//2:]
  #      print(N1,N2)
        if N1 == N2:
   #         print(N1,N2)
            print(len(N))
            break
        else:
            N = N[:len(N)-1]

Submission status: Accepted

Solution code:
import itertools
import math
S = input()

ans = 0
for i in range(len(S)):
    temp = S[:i]
    l = len(temp)
    if l % 2 == 0:
       if  temp[:l//2] == temp[l//2:]:
           ans = max(l,ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
cnt = 0

for i in range(len(S)):
  if S[0:len(S)//2] == S[len(S)//2:len(S) + 1] and cnt != 0:
    print(len(S))
    exit()
  else:
    cnt += 1
    S = S[0:len(S) - 1]

Submission status: Accepted

Solution code:
s = input() 

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

    if len(s) % 2 != 0:
        continue

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

Submission status: Accepted

Solution code:
s=input()
a=0
for x in range(len(s)-1):
    if x%2==0: continue
    for y in range(0,int((x+1)/2)):
        if(s[y]!=s[int((x+1)/2)+y]): break
        if(y==(x-1)/2): a=2*(y+1)
print(a)

Submission status: Accepted

Solution code:
S = input()

for i in range(len(S) - 3, -1, -2):
    d = i // 2 + 1
    if S[0:d] == S[d:2 * d]:
        print(2 * d)
        break

Submission status: Accepted

Solution code:
S = list(input())
N = int(len(S) / 2)

for i in range(N):
    del S[-2:]
    if S[:int(len(S)/2)] == S[int(len(S)/2):]:
        print(len(S))
        break
    else:
        continue

Submission status: Accepted

Solution code:
s = input()
n = len(s)
def ok(x):
    p = len(x)
    return x == x[:p//2]*2
    
ans = 0
for i in range(n-2,-1,-2):
    if ok(s[:i]):
        ans = len(s[:i])
        break
print(ans)