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:
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    s= str(input())
    ls=len(s)
    cur=ls//2
    i=0
    while True:
        i+=1
        cur-=1
        if s[:cur]==s[cur:ls-i*2]:
            print(ls-i*2)
            break


    
resolve()

Submission status: Accepted

Solution code:
S = list(input())

for i in reversed(range(0, len(S) - 2, 2)):
    if S[:i // 2 + 1] == S[i // 2 + 1:i + 2]:
        print(i + 2)
        exit()
print(0)

Submission status: Accepted

Solution code:
s = list(str(input()))
n = len(s)
for i in range(n):
    s.pop()
    #print(''.join(s))
    if len(s)%2 != 0:
        continue
    else:
        if s[0:len(s)//2]*2 == s:
            #print(''.join(s))
            print(len(s))
            exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

while True:
  s = s[:-2:]
  judge = True
  for i in range(len(s)//2):
    if s[i] != s[len(s)//2+i]:
      judge = False
  if judge: 
    print(len(s))
    exit()

Submission status: Accepted

Solution code:
s = str(input())

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

Submission status: Accepted

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

S = input()
S = S[:len(S)-1]

while len(S)!=0:
    l = len(S)
    if l%2==0:
        n = l//2
        A = S[:n]
        B = S[n:]
        # print(A,B)
        if A==B:
            print(l)
            exit()
        else:
            S = S[:l-1]
    else:
        S = S[:l-1]
print("Error")

Submission status: Accepted

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

s = input().rstrip()
ans = 0
for i in range(1, len(s)):
    if i % 2 == 1:
        continue
    s_ = s[:len(s) - i]
    #print(s_, i)
    if s_[:len(s_)//2] == s_[len(s_)//2:]:
        ans = len(s_)
        break
print(ans)

Submission status: Accepted

Solution code:
s = input()

i = 0
while True:
    i += 1
    now = s[:-2*i]
    n = len(now)
    if now[:n//2] == now[n//2:]:
        break

print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    S=readline().strip()
    N=len(S)

    for n in range(N-1,-1,-1):
        if n%2==1:
            continue
        else:
            if S[:n//2]==S[n//2:n]:
                print(n)
                break
if __name__=="__main__":
    main()

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 # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

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

def readInts():
  return list(map(int,input().split()))
def main():
    S = input()
    sl = len(S)
    S = S[:-1]
    sl -= 1
    while True:
        if sl % 2 != 0:
            S = S[:-1]
            sl -= 1
        else:
            if S[:sl//2] == S[sl//2:]:
                print(sl)
                exit()
            else:
                S = S[:-1]
                sl -=1
if __name__ == '__main__':
  main()

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 = input().strip()
N = len(S)
for i in range(2,N,2):
    x = S[:-i]
    y = x[:(N-i)//2]
    z = x[(N-i)//2:]
    if y==z:
        print(N-i)
        break

Submission status: Accepted

Solution code:
s = input()
n = len(s)
def check(x):
    p = len(x)
    a = x[:p//2]
    b = x[p//2:]
    return a == b
for i in range(n-2,-1,-1):
    if check(s[:i+1]):
        print(len(s[:i+1]))
        break

Submission status: Accepted

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

S = input()[:-1]

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(len(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

for i in range(1,len(S)):
    t = S[:-i]
    if len(t)%2: continue
    l = len(t)//2
    if t[:l] == t[l:]:
        print(len(t))
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    N = len(S)
    for i in range(1, N+1):
        t = S[:-i]
        if len(t) % 2 == 1:
            continue
        M = len(t)
        if t[:M//2] == t[M//2:]:
            return print(M)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
k=len(s)
for i in range(1,k+1):
  s=s[0:-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:
def main():
    s = input()
    n = len(s)

    dp = [[0] * (n + 1) for _ in range(n + 1)]
    for j in reversed(range(n)):
        for i in reversed(range(j)):
            if s[i] == s[j]:
                dp[i][j] = min(
                    dp[i + 1][j + 1] + 1,
                    j - i
                )
            else:
                dp[i][j] = 0

    ans = max(x * 2 for x in dp[0] if x * 2 < n)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
n = len(s)
for i in range(2,n,2):
  if s[:i//2] == s[i//2:i]:
    ans = max(i,ans)
print(ans)

Submission status: Accepted

Solution code:

Max_even = 0
def evenserch(S):
    global Max_even
    # print(1)
    f=0
    if(len(S) == 0):
        return Max_even
    else:
        S.pop()
        if(len(S)%2 == 1):
            return evenserch(S)
        else:
            for i in range(int(len(S)/2)):
                # print(i)
                if(S[int(len(S)/2)+i]!=S[i]):
                    f = 1
                    break
            if(f==0):
                if(Max_even < len(S)):
                    Max_even = len(S)
            return evenserch(S)
def main():
    S = list(map(str,input()))
    k = evenserch(S)
    print(k)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = list(input())
lens = len(s)

for i in range(lens):
    for j in range(lens - i):
        left = s[0: j + 1]
        right = s[j + 1: lens - i]
        left = ''.join(left)
        right = ''.join(right)
        if left == right and i != 0:
            print(len(left)+len(right))
            exit()

Submission status: Accepted

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


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    S = readstr()
    ans = 0
    for i in range(0, len(S)):
        s = S[:i]
        if s * 2 in S and s * 2 != S:
            ans = len(s * 2)

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S=input()
N=len(S)
ans=S[0]
for i in range(1,N):
    if i%2==1:
        continue
    T=S[:i]
    T1=T[:i//2]
    T2=T[i//2:]
    if T1==T2:
        ans=T
        #print(T1,T2)
print(len(ans))

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = input()

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

Submission status: Accepted

Solution code:
import sys

# import math
# import bisect

# import copy
# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
# INF = sys.maxsize
# MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    s = input()

    l = len(s)
    for i in range(1, l):
        if (l-i) % 2 == 1:
            continue
        front = s[:(l-i) // 2]
        rear = s[(l-i) // 2:-i]

        if front == rear:
            print(l-i)
            exit(0)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = str(input())

def judge(s):
    if len(s)%2 == 1:
        return 0
    else:
        for i in range(int(len(s)/2)):
            if s[i]!=s[int(len(s)/2)+i]:
                return 0
        return 1

    
x = len(S)
for i in range(1,len(S)):
    S = S[:-1]
    if judge(S)== 1:
        print(x-i)
        break

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = input()

for i in range(1, len(S)//2):
	c = len(S) - 2*i
	ss = S[:c]
	if ss[:c//2] == ss[c//2:]:
		print(c)
		exit()
else:
	print(0)

Submission status: Accepted

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

Submission status: Accepted

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

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 = input().strip()
N = len(S)
for i in range(2,N,2):
    x = S[:-i]
    if x[:(N-i)//2]==x[(N-i)//2:]:
        print(N-i)
        break

Submission status: Accepted

Solution code:
def main():
    from collections import deque
    s = deque(list(input()))
    while deque:
        t = s.pop()
        if len(s)%2 != 0:
            continue
        l = list(s)
        if l[:len(l)//2] == l[len(l)//2:]:
            print(len(l))
            return 0

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = 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:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    S = list(input())
    S.pop()
    while len(S) != 1:
        n = len(S)
        if n % 2 == 0:
            if S[: n // 2] == S[n // 2:]:
                break
        S.pop()

    print(len(S))


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

s = STR()
l = len(s)
for i in reversed(range(1, (l - 1) // 2 + 1)):
    if s[:i] == s[i:2 * i]:
        print(i * 2)
        exit()

Submission status: Accepted

Solution code:
s = list(input())

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

Submission status: Accepted

Solution code:
def main():
    s = input()
    for i in range(-1, -len(s) - 1, -1):
        now = s[:i]
        if len(now) % 2:
            continue
        else:
            if now[:len(now) // 2] == now[len(now) // 2:]:
                print(len(now))
                break


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = list(input())

N = len(S) - 1

n = N // 2

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

Submission status: Accepted

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

Submission status: Accepted

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


def solve(S):
    # S: 文字列
    r = N % 2
    for i in range(1, N//2):
        s = S[:N-(2*i+r)]
        n = len(s)
        #print(s,i,n,s[:(n//2)],s[(n//2):])
        if s[:(n//2)] == s[(n//2):]:
            ans = N - (2 * i + r)
            break
    return ans


print(solve(S))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

def guu(s):
    return 1 if s[0:len(s)//2]==s[len(s)//2:] else 0
t=input().rstrip()
i=2
while i<len(t):
    #print(t[0:i])
    if guu(t[0:i])==1:
        mx=i
    i+=2
print(mx)

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest


def resolve():
    s = list(input())
    ll = len(s)
    ans = 0

    if ll % 2 == 0:
        for i in range(0, ll, 2):
            if i == 0:
                if s[:ll//2+1] == s[ll//2 + 1:]:
                    ans = ll//2
                    break
            else:
                tmp = s[:(-1 * i)]
                if tmp[:len(tmp)//2] == tmp[len(tmp)//2:]:
                    ans = len(tmp)
                    break
    else:
        for i in range(1, ll, 2):
            tmp = s[:-i]
            if tmp[:len(tmp)//2] == tmp[len(tmp)//2:]:
                ans = len(tmp)//2
                break
    print(ans)

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """abaababaab"""
        output = """6"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """xxxx"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """abcabcabcabc"""
        output = """6"""
        self.assertIO(input, output)
    def test_入力例_4(self):
        input = """akasakaakasakasakaakas"""
        output = """14"""
        self.assertIO(input, output)

if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

s = input()
n = len(s)
j = 1
while True:
    c = ""
    for i in range(n-j):
        c += s[i]
    if len(c)%2 == 0:
        d = ""
        f = ""
        for i in range(len(c)//2):
            d += c[i]
            f += c[len(c)//2 + i]
        if d == f:
            print(len(c))
            sys.exit()
    j += 1

Submission status: Accepted

Solution code:
S=list(input())
S=S[:-2]
#print(S,len(S))

def isDouble(s):
  for i in range(len(s)//2):
    if s[i]!=s[i+len(s)//2]:
      return False
  else:
    #print(i,s[i],s[i+len(s)//2])
    return True

for i in reversed(range(0,len(S)+1,2)):
  #print(S[:i])
  if isDouble(S[:i]):
    print(i)
    break

Submission status: Accepted

Solution code:
#B
s = list(input())
for i in range(len(s)):
    s.pop()
    t = len(s)
    if t % 2 == 0 and s[:t // 2] == s[t // 2:]:
        print(t)
        break

Submission status: Accepted

Solution code:
S=input()
flag=0
chara=S
def hantei(moji):
    global flag
    #print(moji)
    length=len(moji)
    #print(length)
    flag=0
    #print(moji[0:length//2])
    #print(moji[(length//2):])
    
    if moji[0:length//2]==moji[(length//2):]:
        flag=1
        #print("Yes")
        return 
    else:
        flag=0
        return 
    
while flag==0:
    #print(flag)
    chara=chara[:-1]
    hantei(chara)
    
print(len(chara))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc, combinations as combi, product, combinations_with_replacement as combi_dup
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#

def main():
    s = IS()
    n = len(s)
    for i in range(2,n,2):
        si = s[:n-i]
        sl = si[:(n-i)//2]
        sr = si[(n-i)//2:]
        if sl == sr:
            print(n-i)
            return None

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
ll = len(s)
ans = 0
for i in range(len(s)):
    s = s[0: len(s)-1]
    if len(s)%2 == 0:
        r = s[0:len(s)//2]
        l = s[len(s)//2:]
        if r == l:
            ans = i + 1
            break
print(ll-ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
    # print(len(S))
    # print(S[0:len(S)])
    if (i == 0):
        S = S[1:]
        continue
    if (len(S) % 2 == 0):
        if (S[0:len(S) // 2] == S[len(S) // 2:]):
            print(len(S))
            break
        else:
            S = S[1:]
    else:
        S = S[1:]

Submission status: Accepted

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

for i in range(1, n):
    m = n - i
    if m % 2 != 0:
        continue
    #print(s[0:m//2], s[m//2:m])
    if s[0:m//2] == s[m//2:m]:
        break
print(m)

Submission status: Accepted

Solution code:
S = list(input())
len_S = len(S)

for i in range(1, len_S):
    partial_S = S[:-i]
    len_partial_S = len(partial_S)
    if len_partial_S % 2 != 0:
        continue
    hf = int(len_partial_S / 2)
    if ''.join(partial_S[:hf]) == ''.join(partial_S[hf:]):
        print(len_partial_S)
        break

Submission status: Accepted

Solution code:
s = list(input())
ss = s[::]

for i in range(len(s)):
	if len(ss) == 1:
		break
		
	ss.pop()
	if len(ss) % 2 == 0:
		n = len(ss) // 2
		if ss[:n] == ss[n:]:
			break

if len(ss) == 1:
	print(-1)
else:
	print(len(ss))

Submission status: Accepted

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


def read():
    S = input().strip()
    return S,


def solve(S):
    N = len(S)
    for i in range(N // 2 - 1, 0, -1):
        a0 = 0
        a1 = i
        b0 = i
        b1 = i + i
        if S[a0:a1] == S[b0:b1]:
            return b1
    return 0


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))

Submission status: Accepted

Solution code:
S=input()
while True:
    S=S[:-2]
    N=len(S)
    if S[:N//2]==S[N//2:]:
        print(N)
        break

Submission status: Accepted

Solution code:
moji = str(input())
cnt = 0
while len(moji)!=0:
  lst = list(moji)
  del lst[-1]
  cnt += 1
  moji = ''.join(lst)
  if len(moji)%2==0:
    centre = int(len(moji)/2)
    if lst[0:centre] == lst[centre:len(lst)+1]:
      print(len(lst))
      break;

Submission status: Accepted

Solution code:
S = input()
n = len(S)-1

while n > 1:
    n = len(S)
    S = S[:n-1]
    if len(S)%2 != 0:
        continue
    m = len(S)//2
    x = S[:m]
    y = S[m:]
    if x == y:
        n =len(S)
        break

print(n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

while True:
    S = S[:-2]
    N = len(S)
    if S[:N // 2] == S[N // 2:]:
        print(N)
        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]:
        ans = len(S)-i
        break
print(ans)

Submission status: Accepted

Solution code:
def resolve():
	s = input()
	ans = 0
	for i in range(len(s)-1, 1, -1):
		if len(s[:i]) % 2:
			next
		else:
			if s[:i//2] == s[i//2:i]:
				ans = max(ans, len(s[:i]))
	print(ans)
resolve()

Submission status: Accepted

Solution code:
S = input()
a = (len(S) - 1) // 2 * 2

for i in range(a, 1, -2):
    if S[:i//2] == S[i//2:i]:
        print(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 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    S = input()
    while True:
        S = S[:-2]
        L = len(S)
        if S[:L//2] == S[L//2:]:
            print(L)
            break



if __name__ == '__main__':
    main()

Submission status: Accepted

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