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 = list(input())

length = len(S)
S.pop()
for _ in range(length):
    if len(S) % 2 != 0:
        S.pop()
        continue

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

    else:
        S.pop()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

f = False
sl = len(s)
while f == False:
    sl -= 2
    if s[0:sl//2] == s[(sl+1)//2:sl]:
        f = True

print(sl)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())
i = 2
while True:
    s = s[:len(s)-2]
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        break
    i += 2

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
# i = 2
while S != []:
    S.pop()
    S.pop()
    l = len(S)
    half = int(l / 2)
    # print(S)
    # print(S[0:half])
    # print(S[half:])
    if S[0:half] == S[half:]:
        print(l)
        exit()

Submission status: Accepted

Solution code:
s = input()
#s = "akasakaakasakasakaakas"
lens = len(s)
if len(s)%2 == 1:
    s = s[0:-1]
else:
    s = s[0:-2]
for i in range(lens):
    half = int(len(s)/2)
    if s[0:half] == s[half:half*2]:
        print(half*2)
        break
    else:
        s = s[0:-2]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def readinput():
    s=input()
    return s

def main(s):
    i=len(s)-2
    while(i>0):
        lensub=i//2
        sub1=s[:lensub]
        sub2=s[lensub:lensub*2]
        if sub1==sub2:
            return i
        i-=2
    return 0

if __name__=='__main__':
    s=readinput()
    ans=main(s)
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
s=s[:-1]
while True:
  if len(s)%2==0 and s[len(s)//2:]==s[:len(s)//2]:
    print(len(s))
    break
  else:
    s=s[:-1]
    continue

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
n = len(s)
ans = 0
for i in range(1, n+1):
    temp_s = s[0:n-i]
    temp_n = len(temp_s)
    if temp_s[0:temp_n//2] == temp_s[temp_n//2:]:
        ans = temp_n
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    s = list(input()[:-1].decode())
    n = len(s)
    for i in reversed(range(n - 1)):
        if (i + 1) % 2 == 0:
            l = ''.join(s[:(i + 1) // 2])
            r = ''.join(s[(i + 1) // 2:i + 1])
            if l == r:
                print(i + 1)
                exit()


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    s=input()[:-2]
    while not is_even(s):
        s = s[:-2]
    print(len(s))

def is_even(s):
    half = len(s) // 2
    return s[:half] == s[half:]
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: str):
    if len(S)%2==1:
        S = S[:-1]
    else:
        S = S[:-2]

    while len(S):
        N = len(S) // 2
        if S[:N]==S[N:]:
            break
        S = S[:-2]

    print(len(S))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()
m = len(S)//2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
s=list(input())
for i in range(len(s)//2):
    s=s[:-2]
    sa=s[:len(s)//2]
    sb=s[len(s)//2:]
    if sa==sb:
        print(len(s))
        sys.exit()

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

Solution code:
def resolve():
    s = input()
    len(s)

    for i in range(len(s)):
        s = s[0 : -1]
        #print(f"{s} length is {len(s)}")
        if len(s) % 2 == 0:
            sa = s[0 : int(len(s)/2)]
            sb = s[int(len(s)/2) : ]
            #print(f"sa is {sa} \nsb is {sb}")
            if sa == sb:
                print(len(s))
                break
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
l = len(s)-2

while True:
    s = s[0:l]
    h = int(l/2)
    if s[0:h] == s[h:l]:
        print(l)
        exit(0)
    else:
        l = l-2

Submission status: Accepted

Solution code:
s = str(input())
for i in range(1, 200):
    a = s[:-i]
    if len(s)%2 != 0:
        pass
    elif a[:len(a)//2] == a[len(a)//2:]:
        print(len(a))
        break
    else:
        pass

Submission status: Accepted

Solution code:
S=input()
temp=len(S)+1
for i in range(0,temp):
  S=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 = input()

deletes = -1
while len(S) + deletes > 0:
    # 削る
    test_s = S[:deletes]

    # 判定
    if len(test_s) % 2 == 0:
        l = test_s[:len(test_s) // 2]
        r = test_s[len(test_s) // 2:]

        if l == r:
            break

    deletes -= 1

# print(deletes, test_s, l, r)
print(len(test_s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(str(input()))
d = len(s)
for i in range(d):
    s.pop()
    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()
ans = 0
for i in range(1, len(s)):
    tmp = s[:i]
    if tmp[:i//2] == tmp[i//2:]:
        if len(tmp) > ans:
            ans = len(tmp)
print(ans)

Submission status: Accepted

Solution code:
s = input()
#abaababaab
for i in range(len(s)):
	ss = s[:-(i+1)]
	if ss[:len(ss)//2] == ss[len(ss)//2:]:
		break

print(len(ss))

Submission status: Accepted

Solution code:
s=input()
x=len(s)
c=0
for j in range(x-1,0,-1):
    for i in range(1,(x-1)//2+1):
        if  s[0:i]*int(j//i)==s[0:j] and j//i%2==0:
            print(j)
            c+=1
            break
    if c==1:
        break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def evenstring(s) : 
  while len(s) > 0 : 
    s = s[ : -2]
    t1 = s[ : int(len(s) / 2)]
    t2 = s[int(len(s) / 2) : ]
    if t1 == t2 : 
      return len(t1) + len(t2)
  

s = input()

print(evenstring(s))

Submission status: Accepted

Solution code:
s = list(input())

while (s):
    s.pop()
    s.pop()
    sl = s[:len(s) // 2]
    sr = s[len(s) // 2:]
    if sl == sr:
        # print(sl)
        # print(sr)
        print(len(sl) * 2)
        exit()

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))
    exit()
  s = s[:-2]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
n = len(s)
mid = (n//2)-1
del s[-2:]
m = 0
while mid > 0:
  if s[:mid]==s[mid:]:
    m = (mid<<1)
    break
  del s[-2:]
  mid-=1
print(m)

Submission status: Accepted

Solution code:
# ABC 066 B
S =input()

m = 0
for i,s in enumerate(S):
    tmp = S[:-1-i]
    tmp1 = tmp[:len(tmp)//2]
    tmp2 = tmp[len(tmp)//2:]
    if len(tmp)%2==0 and(tmp1==tmp2):
        m = max(m,len(tmp))
print(m)

Submission status: Accepted

Solution code:
s = input()

l = len(s)
ans = l

for _ in range(l//2-1):
  l -= 2
  if s[0:l//2-1] == s[l//2:l-1]:
    ans = l
    break
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

length = len(s)

for a in range(length, 1, -1):
  temp = s[:a]
  if len(temp) %2 == 0:
    half = len(temp)//2
    if temp[:half] == temp[half:]:
      ans = len(temp)
      break #ここでbreakするために，forを大きいところから回してる
    
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
09min 20sec WA
17min 25sec WA
"""
# 偶文字列の長さは必ず偶数。
# len(S) == 2nのとき、2i文字取り去った後が、
# (n-i)文字を二つ並べたものかどうかを調べる。
# break を入れ忘れてWAした。
# print()を消し忘れてWAした。

def main():
    S = input()
    n = len(S)//2
    answer = int()
    for i in range(1, n):
        #print(S[:(n-i)], S[(n-i):2*(n-i)])
        if S[:(n-i)] == S[(n-i):2*(n-i)]:
            answer = 2*(n-i)
            break
    print(answer)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

s = s[:-1]
length = len(s)

for a in range(length, 1, -1):
    tmp = s[:a]
    if len(tmp) % 2 == 0:
        half = len(tmp)//2
        if tmp[:half] == tmp[half:]:
            ans = len(tmp)
            break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


s = input()

end = len(s)-1
res = 2
while end > 1:
    if end % 2 == 0:
        mid = end // 2
        left = s[:mid]
        right = s[mid:end]
        if left == right:
            res = len(left)
            break
        else:
            end -= 1
    else:
        end -= 1
print(res+res)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = str(input())

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

import sys
S = S[:-1]

while len(S) > 1:
    if len(S)&1 == 1:
        S = S[:-1]
    else:
        ok = True
        mid = len(S)//2

        for i in range(mid):
            if S[i] != S[mid + i]:
                ok = False
                break
        
        if ok:
            print(len(S))
            sys.exit()
        
        S = S[:-1]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def is_even_seq(s):
    len_s = len(s)
    if len_s % 2 != 0:
        return False
    left = s[: (len_s // 2)]
    right = s[(len_s // 2) :]

    return left == right


def test():
    assert is_even_seq("abaababaab")


if __name__ == "__main__":
    S = input()
    for i in range(1, len(S) - 1):
        s = S[:-i]
        if is_even_seq(s):
            print(len(s))
            sys.exit(0)

Submission status: Accepted

Solution code:
s = list(input())

del s[-1]

for i in range(len(s)):
  mid = len(s) // 2
  front = ''.join(s[0:mid])
  rear = ''.join(s[mid:len(s)])
#  print("s:",s)
#  print("mid:",front, rear)
  if len(s) % 2 == 0 and front == rear:
    print(len(s))
    break
  else:
    del s[-1]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

while True:
  S = S[:-2]
  l = len(S)
  T = S[:int(l/ 2)]
  U = S[int(l/ 2):]
  if(T == U):
    print(l)
    break

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = input()
    for i in range(1,len(s)):
        s2 = s[:len(s)-i]
        count =0
        if len(s2) % 2 ==0:
            for j in range(len(s2)// 2):
                if s2[j] == s2[len(s2)// 2 + j]:
                    count+=1


            if count == len(s2)//2:
                print(len(s2))
                break

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    S = list(input().rstrip())
    ok = False
    ans = len(S)
    while not ok:
        S.pop()
        ans -= 1
        if len(S) % 2 == 0 and S[:len(S)//2] == S[len(S)//2:]:
            ok = True
    print(ans)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

S = input()

l = len(S)

S = S[:-1] if l % 2 != 0 else S[:-2]

for i in range(l // 2):
    if S[:l // 2 - i] == S[l // 2 - i:l - 2 * i]:
        print(l - 2 * i)
        break

Submission status: Accepted

Solution code:
S = list(input())

length = len(S)

while True:
    length -= 2
    half = length // 2
    if S[0] == S[half]:
        cnt = 0
        for i in range(half):
            if S[i] != S[half + i]:
                break
            cnt += 1
        
        if cnt == half:
            print(length)
            exit()

Submission status: Accepted

Solution code:
S = [i for i in str(input())]
S = S[:-2]

while True:
    if S[0:int(len(S)/2)] == S[int(len(S)/2):]:
        print(len(S))
        break
    else:
        S = S[:-2]

Submission status: Accepted

Solution code:
S = input()

S = S[:-2]
flg = True
while flg:
    flg = False
    x = 0
    for i in range(len(S)//2):
        if S[x] != S[len(S)//2 + x]:
            flg = True
            S = S[:-2]
            break
        x += 1

print(len(S))

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 :]:
            print(len(S))
            break

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1             # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    def check_even_string(s):
        n = len(s)
        if n % 2 != 0:
            return False
        for i in range(n//2):
            if s[i] != s[i+n//2]:
                return False
        return True
    

    
    s = input()
    n = len(s)
    for i in range(n - 1, 1, -1):
        if check_even_string(s[:i]):
            print(i)
            exit()


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s=input()
cnt=len(s)-2
while cnt>0:
  #print(s[0:cnt//2],s[cnt//2:cnt])
  if s[0:cnt//2]==s[cnt//2:cnt]:
    break
  cnt-=2
print(cnt)

Submission status: Accepted

Solution code:
import math
s = input()
flag=False
for i in range(len(s)):
  S=s[:len(s)-1-i]
  if len(S)%2==1:
    continue
  if len(S)>1:
    if S[:round(len(S)/2)]==S[round(len(S)/2):]:
      ans = len(S)
      flag=True
  else:
    ans=1
  if flag:
    break
print(ans)

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
s = input()
i = 2
while True:
    #print(s[0:((len(s)-i)//2)])
    #print(s[((len(s)-i)//2):(len(s)-i)])
    if s[0:((len(s)-i)//2)] == s[((len(s)-i)//2):(len(s)-i)]:
        print(len(s[0:(len(s)-i)//2])*2)
        exit()
    else:
        i += 2

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def oddmoji(x):
  lx=int(len(x)/2)
  if x[:lx]==x[lx:]:
    return True
  else:
    return False

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
i = n
while True:
    if ans != 0 and s[0:i//2] == s[i//2:i]:
        print(n - ans)
        exit()
    i -= 2
    ans += 2

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:
s=input()
n=len(s)
for i in range(1,n//2):
  if s[0:n//2-i]==s[n//2-i:n-2*i]:
    print(n-2*i)
    break
  #print(s[0:n//2-i],s[n//2-i:n-2*i])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

for i in reversed(range(len(S))):
    tmp = S[:i]
    n = len(tmp)//2
    if tmp[:n] == tmp[n:]:
        print(len(tmp))
        break

Submission status: Accepted

Solution code:
def is_even_string(x):
    return x[:len(x)//2] == x[len(x)//2:]

s = input()

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

Submission status: Accepted

Solution code:
S = input()
n = len(S)-1
while n > 0:
    if n % 2 == 1:
        n -= 1
        continue
    m = n//2
    if S[:m] == S[m:+2*m]:
        break
    n -= 1

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

def resolve():
    def main(x):
        xlen=len(x)
        if x==x[:xlen//2]*2:
            return True
        else:
            return False
    s=input()
    for i in range(2,len(s),2):
        x=s[:-i]
        if main(s[:-i]):
            print(len(s[:-i]))
            break
resolve()

Submission status: Accepted

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

def resolve():
    def main(x):
        xlen=len(x)
        if x==x[:xlen//2]*2:
            return True
        else:
            return False
    s=input()
    if len(s)==2:
        print(1)
    else:
        for i in range(2,len(s)-1,2):
            x=s[:-i]
            if main(s[:-i]):
                print(len(s[:-i]))
                break
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


def is_even_string(string):
    l = len(string)
    first = string[:l//2]
    last = string[l//2:]
    return first == last


while not is_even_string(s):
    s = s[:-2]

print(len(s))

Submission status: Accepted

Solution code:
s = input()

l = len(s)
start = 2 if l % 2 == 0 else 1

isFound = False
for i in range(start, len(s), 2):
    m = int((l-i)/2)
    if s[0:m] == s[m:(l-i)]:
        isFound = True
        print(l-i)
        break

if not isFound:
    print(-1)

Submission status: Accepted

Solution code:
S = list(input())

ans = 0
judege = 1
while ans == 0:
    S.pop(-1)
    if len(S) % 2 == 1:
        continue
    front = S[:len(S) // 2]
    end = S[len(S) // 2:]
    if front == end:
        ans = len(S)

print(ans)

Submission status: Accepted

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

while S:
    center = len(S) // 2
    left, right = S[:center], S[center:]
    if left == right:
        print(len(left) * 2)
        break
    else:
        S = S[:-2]

Submission status: Accepted

Solution code:
S = input()
s = len(S)
ans = list()
if s == 2:
  print(1)

for i in range(1,(s+2)//2):
  a = s - i*2
  if a == 0:
    ans.append(1)
  test = S[0:a]
  n = 0
  while True:
    if n == a/2:
      ans.append(len(test))
      break
    elif test[n] != test[n + a//2]:
      break
    else:
      n += 1
print(max(ans))

Submission status: Accepted

Solution code:

s = list(input())
del s[-1]

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

Submission status: Accepted

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

S = input().rstrip()

for i in range(len(S)):
  S = S[:-1]
  Slen = len(S)
  if Slen % 2 != 0:
    pass
  if S[:int(Slen/2)] == S[int(Slen/2):]:
    print(int(Slen))
    sys.exit()

Submission status: Accepted

Solution code:
s = input()

ans = 0
for i in range(1, len(s)):
    temp = s[:-i]
    n = len(temp) // 2
    if temp[:n] == temp[n:]:
        ans = max(ans, len(temp))

print(ans)

Submission status: Accepted

Solution code:
word = input()
word = word[:-2]

for i in range(len(word)):
    if word[:int(len(word)/2)] == word[int(len(word)/2):]:
        break
    word = word[:-2]

print(len(word))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = input()
for i in range((len(S)+1) % 2, len(S), 2):
    wordlen = (len(S)-i)//2
    if S[:wordlen] == S[wordlen:wordlen*2]:
        print(wordlen*2)
        quit()