AtCoder Beginner Contest 066 - ss

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-----
abaababaab

-----Sample Output-----
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.

Difficulty: EASY

Starter code:

Solutions:
s = input()
while s:
	s = s[:-1]
	i = len(s) // 2
	if s[:i] == s[i:]:
		print(len(s))
		break


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


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


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)


import re
print(len(re.match('(.+)\\1', input()[:-1]).group()))


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


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


a = str(input())
a = a[:-2]
l = len(a)
while a[:l // 2] != a[l // 2:]:
	a = a[:-2]
	l = len(a)
print(len(a))


S = list(input())
for i in range(2, len(S)):
	miniS = S[0:-i]
	if len(miniS) % 2 == 0:
		front = ''.join(miniS[0:len(miniS) // 2])
		back = ''.join(miniS[len(miniS) // 2:len(miniS)])
		if front == back:
			print(len(miniS))
			return


print(len(__import__('re').search('(.+)\\1', input()[:-1]).group(0)))


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


s = list(input())
while 1:
	s.pop()
	s.pop()
	if s[:len(s) // 2] == s[len(s) // 2:]:
		print(len(s))
		exit()


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


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


A = str(input())
A = A[:-2]
N = len(A)
while A[:N // 2] != A[N // 2:]:
	A = A[:-2]
	N = len(A)
print(len(A))


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


from sys import stdin, stdout
import numpy as np

def solve():
	s = input()
	n = len(s)
	ans = 1
	for end in range(2, n, 2):
		even = True
		for i in range(end // 2):
			if s[i] != s[end // 2 + i]:
				even = False
				break
		if even:
			ans = end
	print(ans)

def main():
	solve()

def __starting_point():
	main()
__starting_point()


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


s = input()
l = len(s)
while True:
	l -= 2
	if s[:l // 2] == s[l // 2:l]:
		print(l)
		break


def judge(Str, Len):
	if Str[:Len // 2] == Str[Len // 2:]:
		return True
	else:
		return False
S = input()
L = len(S)
i = 2 - L % 2
S = S[:-i]
L -= i
if judge(S, L):
	print(L)
else:
	while not judge(S, L):
		S = S[:-2]
		L -= 2
	print(L)


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


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


s = input()
for n in reversed(range(len(s) - 1)):
	if s[0:n // 2] == s[n // 2 + 1:n]:
		print(n + 1)
		break


s = input()

def judge(S):
	if len(S) % 2 == 0 and S[:len(S) // 2] == S[-1 * len(S) // 2:]:
		return True
	else:
		return False
for i in range(len(s)):
	s = s[:-1]
	if judge(s):
		print(len(s))
		break


S = input()
n = 0
for i in range(200):
	n += 2
	s = S[:len(S) - n]
	if s[:len(s) // 2] == s[len(s) // 2:]:
		print(len(s))
		return


s = list(input())
while len(s) != 0:
	s.pop(len(s) - 1)
	if s[:len(s) // 2] * 2 == s:
		break
print(len(s))


s = list(input())
while True:
	s.pop()
	c = len(s)
	if s[:c // 2] == s[c // 2:]:
		print(c)
		exit()


S = input()
l = S.__len__()
for i in range((l - 1) // 2, 0, -1):
	if S[0:i - 1] == S[i:i + i - 1]:
		print(2 * i)
		break


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


s = list(input())
while s:
	s.pop()
	l = len(s)
	if s[:l // 2] * 2 == s:
		break
print(l)


S = input()
while S:
	S = S[:-2]
	l = len(S) // 2
	if S[l:] == S[:l]:
		print(l * 2)
		exit()


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


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


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


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


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


s = input()
n = len(s) - 2
while not s[0:n // 2] == s[n // 2:n]:
	n = n - 2
print(n)


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


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


s = input()
res = 0
for i in range(len(s)):
	if i % 2 != 0:
		pass
	elif s[:i // 2] == s[i // 2:i]:
		res = i
print(res)


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


n = input()
for i in range(int(len(n) / 2) - 1, 0, -1):
	if n[:i] == n[i:i + i]:
		print(2 * i)
		quit()


s = input()
s = list(s)
del s[-1]
del s[-1]
while True:
	if s[:len(s) // 2] == s[len(s) // 2:]:
		print(len(s))
		return
	else:
		del s[-1]
		del s[-1]


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


S = input()
l = len(S)
while 1:
	S = S[:-2]
	l -= 2
	(p, n) = (S[:l // 2], S[l // 2:])
	if p == n:
		break
print(l)


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


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


S = input()
for i in range(2, len(S) + 2, 2):
	split = int(len(S[:-i]) / 2)
	if S[:split] == S[split:-i]:
		print(len(S[:-i]))
		return


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


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


s = input()

def check(a):
	if len(a) % 2 == 1:
		return False
	if a[:len(a) // 2] == a[len(a) // 2:]:
		return True
	return False
for i in range(len(s)):
	if check(s[:-1 - i]):
		print(len(s) - i - 1)
		break


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


def f():
	s = list(input())
	for i in range(len(s)):
		s.pop(-1)
		s.pop(-1)
		c = 0
		for j in range(len(s) // 2):
			if s[j] == s[len(s) // 2 + j]:
				c += 1
				if c == len(s) // 2:
					return len(s)
			else:
				break
print(f())


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


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


s = input()
ans = 0
for _ in range(1, len(s)):
	s = s[:-1]
	if len(s) % 2 == 0:
		if s[:len(s) // 2] == s[len(s) // 2:]:
			ans = max(ans, len(s))
	else:
		continue
print(ans)


s = input()
while 1:
	s = s[:-1]
	if len(s) % 2 == 0 and s[:len(s) // 2] * 2 == s:
		print(len(s))
		break


S = list(input())[:-2]

def check(S):
	half = len(S) // 2
	if S[:half] == S[half:]:
		return True
	else:
		return False
while True:
	if check(S):
		print(len(S))
		break
	S = S[:-2]


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


S = input()
while 1:
	S = S[:-2]
	if S[:len(S) // 2] == S[len(S) // 2:]:
		break
print(len(S))


s = str(input())
ans = 0
for i in range(len(s) - 1, 0, -1):
	if i % 2 != 0:
		continue
	if s[0:i // 2] == s[i // 2:i] and i > ans:
		ans = i
	elif i <= ans:
		break
if len(s) == 2:
	ans = 2
print(ans)


s = input()
for i in range(2, len(s), 2):
	t = s[:len(s) - i]
	u = t[:len(t) // 2]
	if u + u == t:
		print(len(t))
		return


N = str(input())
while True:
	N = N[0:-1]
	if len(N) % 2 == 0:
		if N[0:int(len(N) / 2)] == N[int(len(N) / 2):]:
			break
print(len(N))


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


S = list(input())
import sys
for i in range(len(S)):
	del S[-1]
	for j in range(len(S)):
		if len(S) % 2 == 0:
			if S[0:len(S) // 2] == S[len(S) // 2:len(S)]:
				print(len(S))
				return
else:
	print(0)


def main():
	s = list(input())
	for _ in range(len(s)):
		s.pop()
		if len(s) % 2 == 0:
			p = len(s) // 2
			if s[0:p] == s[p:]:
				print(len(s))
				return
main()


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


S = input()
l = len(S)
l = (l - 2) // 2
while l > 0:
	if S[0:l] == S[l:2 * l]:
		print(2 * l)
		break
	l = l - 1


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


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


import sys
import copy
import math
import itertools
import numpy as np
S = input()
for i in range(1, len(S)):
	l = len(S[0:len(S) - i])
	if l % 2 == 0:
		if S[0:len(S) - i] == S[0:int(l / 2)] + S[0:int(l / 2)]:
			print(l)
			return


(s, i) = (input(), 1)
while s[:(len(s) - 2 * i) // 2] != s[(len(s) - 2 * i) // 2:-2 * i]:
	i += 1
else:
	print(len(s) - 2 * i)


s = list(input())
for i in range(len(s)):
	s.pop(-1)
	if len(s) % 2 == 1:
		continue
	if s[:len(s) // 2] == s[len(s) // 2:]:
		print(len(s))
		break


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


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


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


s = list(input())
ans = 0
if len(s) % 2 == 0:
	s = s[:-2]
else:
	s.pop(-1)
while len(s) > 0:
	if s[0:int(len(s) / 2)] == s[int(len(s) / 2):len(s)]:
		ans = len(s)
		break
	else:
		s = s[:-2]
print(ans)


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


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


n = input()
while len(n) > 0:
	n = n[:-2]
	if n[:len(n) // 2] == n[len(n) // 2:]:
		print(len(n))
		break


S = input()
i = len(S) // 2
while True:
	i -= 1
	if S[:i] == S[i:i * 2]:
		print(i * 2)
		exit()


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


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


s = input()
num = len(s)
tar_index = len(s) - 1
count = 0
while count < num:
	tar = s[:tar_index]
	tar_num = len(tar)
	if tar_num % 2 == 0:
		half = int(tar_num / 2)
		if tar[:half] == tar[half:]:
			print(int(2 * len(tar[:half])))
			return
		else:
			pass
	else:
		pass
	tar_index -= 1
	count += 1


s = [i for i in input()]
del s[-2:]
while s[:len(s) // 2] != s[len(s) // 2:]:
	del s[-2:]
print(len(s))


S = input()
test = ''
tmp = 0
for i in range(1, len(S)):
	j = -1 * i
	test = S[:j]
	tmp = len(test) // 2
	if len(test) % 2 == 0 and test[0:tmp] == test[tmp:]:
		print(len(test))
		return


S = input()
lenS = len(S)
if lenS % 2 == 0:
	S = S[:-1]
ans = 0
for i in range(1, lenS, 2):
	idx = -i
	_S = S[:idx]
	idx = len(_S) // 2
	if _S[:idx] == _S[idx:]:
		ans = len(_S)
		break
print(ans)


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


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


import sys
S = input()
ans = 0
for i in range(len(S) // 2):
	S = S[:len(S) - 2]
	count = 0
	for j in range(len(S) // 2):
		if S[j] != S[len(S) // 2 + j]:
			break
		else:
			count += 1
	if count == len(S) // 2:
		print(len(S))
		return


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


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


S = input()
L = len(S) // 2 - 1
while S[:L] != S[L:2 * L]:
	L -= 1
print(2 * L)


s = str(input())
flag = 0
for i in range(1, len(s)):
	s = s[:len(s) - 2]
	for j in range(len(s) // 2):
		if s[j] != s[len(s) // 2 + j]:
			flag = 1
			break
	if flag == 0:
		print(len(s))
		return
	else:
		flag = 0
		continue


s = input()
for i in range(len(s)):
	ss = s[:-2 - i]
	size = len(ss)
	if size % 2 == 0 and ss[:size // 2] == ss[size // 2:]:
		print(size)
		return


s = input()
for i in range(1, 101):
	s_del_end = s[:len(s) - i]
	len_s_del_end = len(s_del_end)
	if s_del_end[:len_s_del_end // 2] == s_del_end[len_s_del_end // 2:] and len_s_del_end % 2 == 0:
		print(len_s_del_end)
		return


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


S = input()
while True:
	S = S[:-1]
	if len(S) % 2 == 0 and S[:len(S) // 2] * 2 == S:
		print(len(S))
		break


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


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


import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input():
	return int(input())

def i_map():
	return list(map(int, input().split()))

def i_list():
	return list(i_map())

def i_row(N):
	return [i_input() for _ in range(N)]

def i_row_list(N):
	return [i_list() for _ in range(N)]

def s_input():
	return input()

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

def s_list():
	return list(s_map())

def s_row(N):
	return [s_input for _ in range(N)]

def s_row_str(N):
	return [s_list() for _ in range(N)]

def s_row_list(N):
	return [list(s_input()) for _ in range(N)]

def lcm(a, b):
	return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

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

def __starting_point():
	main()
__starting_point()


s = str(input())[:-1]
while True:
	i = len(s) // 2
	if s[:i] == s[i:]:
		print(len(s))
		break
	else:
		s = s[:-1]


S = input()
i = len(S)
while i:
	i -= 2
	if S[0:i // 2] == S[i // 2:i]:
		print(i)
		break


x = input()
l = (len(x) - 1) // 2
for i in range(l, 0, -1):
	if x[:i] == x[i:i + i]:
		print(i + i)
		break


s = input()[:-2]
while not s[0:len(s) // 2] == s[len(s) // 2:]:
	s = s[:-2]
	c = len(s) // 2
print(len(s))


a = input().strip()
for i in range(len(a) // 2 - 1, 0, -1):
	if a[:i] == a[i:2 * i]:
		print(2 * i)
		break


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


s = list(input())
s.pop()
while s[:len(s) // 2] != s[len(s) // 2:]:
	s.pop()
print(len(s))


class mystr:

	def __init__(self, string):
		self.value = string

	def isEven(self):
		l = len(self.value)
		if not l & 1 and self.value[:l // 2] == self.value[l // 2:]:
			return True
		else:
			return False

	def pop(self):
		l = len(self.value)
		self.value = self.value[:l - 1]
s = mystr(input())
l = len(s.value)
for i in reversed(list(range(l))):
	s.pop()
	if s.isEven():
		print(i)
		break


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


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

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


S = input()
ans = len(S) - 2
while S[:int(ans / 2)] != S[int(ans / 2):int(ans)]:
	ans = ans - 2
print(ans)


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


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


s = input()
s = s[0:-2]
while s != s[0:int(len(s) / 2)] * 2:
	s = s[0:-2]
print(len(s))


import sys
S = input()
for i in range(1, len(S)):
	s = S[:-i]
	l = len(s) // 2
	if s[:l] == s[l:]:
		print(len(s))
		return


S: str = input()
for i in range(len(S) - 2, 0, -2):
	words: str = S[:i]
	half: int = len(words) // 2
	if words[:half] == words[half:]:
		print(half * 2)
		break


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


S = list(input())

def judge(A):
	if len(A) % 2 == 0:
		if A[:len(A) // 2] == A[len(A) // 2:]:
			return True
	return False
for i in range(len(S)):
	S.pop()
	if judge(S):
		break
print(len(S))


S = input()
S = S[0:-2]
while S[0:int(len(S) / 2 - 1)] != S[int(len(S) / 2):len(S) - 1]:
	S = S[0:-2]
print(len(S))


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


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


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


S = str(input())
S = S[:-2]
for _ in range(len(S) // 2):
	if S[:len(S) // 2] == S[len(S) // 2:]:
		print(len(S))
		break
	else:
		S = S[:-2]


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


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


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


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


S = list(input())[:-2]
n = len(S)
while S[:n // 2] != S[n // 2:]:
	S = S[:-2]
	n -= 2
print(n)


S = list(input())
for _ in range(len(S) - 1):
	del S[-1]
	if S[:int(len(S) / 2)] == S[int(len(S) / 2):]:
		break
print(len(S))


s = list(input())
while True:
	s.pop()
	s.pop()
	t = len(s) // 2
	if s[:t] == s[t:]:
		print(len(s))
		exit()


S = input()
odd = len(S) % 2
little = odd + (1 - odd) * 2
start = len(S) - 1 - little
ans = 0
for i in range(start, 0, -2):
	half = (i + 1) // 2
	a = S[:half]
	b = S[half:half * 2]
	if a == b:
		ans = len(a) * 2
		break
print(ans)


def answer(s: str) -> int:
	if len(s) % 2 == 1:
		s += ' '
	for _ in range(len(s) // 2):
		s = s[:-2]
		l = len(s)
		middle = l // 2
		if s[:middle] == s[middle:]:
			return l

def main():
	s = input()
	print(answer(s))

def __starting_point():
	main()
__starting_point()


s = input()
for i in range(1000):
	s = s[:-2]
	tnp = 0
	for j in range(len(s) // 2):
		if s[j] != s[len(s) // 2 + j]:
			tnp += 1
	if tnp == 0:
		print(len(s))
		break


import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10 ** 6)

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

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

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

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

def check(s):
	if s[len(s) // 2:] == s[:len(s) // 2]:
		print(len(s))
		return
S = S()
n = len(S)
if n % 2 == 0:
	while S:
		S = S[:-2]
		check(S)
else:
	S = S[:-1]
	check(S)
	while S:
		S = S[:-2]
		check(S)


s = input()
while len(s) > 1:
	s = s[:-1]
	h = int(len(s) / 2)
	if s[:h] == s[h:]:
		print(len(s))
		exit()


a = input()
b = 0
c = len(a) // 2
for i in range(c - 1):
	if a[0:i] == a[i + 1:i + 1 + i]:
		b = i + 1
print(b * 2)


S = str(input())
for i in range(1, int(len(S) / 2)):
	T = S[0:len(S) - 2 * i]
	clear = 0
	m = int(len(T) / 2)
	for j in range(m):
		if T[j] == T[m + j]:
			clear += 1
	if clear == m:
		print(len(T))
		break


S = list(input())
while S:
	del S[-2:]
	T = S[len(S) // 2:]
	if T == S[:len(S) // 2]:
		print(len(S))
		break


e = lambda s: s[:len(s) // 2] == s[len(s) // 2:]
s = input()
while 1:
	s = s[:-2]
	if e(s):
		print(len(s))
		break


s = input()
while s:
	s = s[:-1]
	c = len(s) // 2
	if s[:c] == s[c:]:
		print(len(s))
		break


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


s = list(input())
del s[-2:]
k = len(s) // 2
while s[:k] != s[k:]:
	del s[-2:]
	k = len(s) // 2
print(len(s))


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


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


S = input()
while True:
	S = S[:-1]
	l = len(S)
	if S[:l // 2] * 2 == S:
		print(l)
		break


S = list(input())
S.pop()
while S[:len(S) // 2] != S[len(S) // 2:]:
	S.pop()
print(len(S))


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


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


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


import sys
input = sys.stdin.readline

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

def __starting_point():
	main()
__starting_point()


s = input()
while 1:
	s = s[:-2]
	l = len(s)
	if s[:l // 2] == s[l // 2:]:
		print(l)
		break


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


S = input()
while len(S) > 0:
	S = S[:-1]
	mid = len(S) // 2
	if S[:mid] == S[mid:]:
		print(len(S))
		break


s = input()[:-1]
print(max((i * 2 for i in range(99) if s[:i] == s[i:i * 2])))


S = input()
N = len(S)
for i in range(N - 1, 0, -1):
	if i % 2 == 1:
		continue
	if S[:i // 2] == S[i // 2:i]:
		ans = i
		break
print(ans)


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


s = input()
while len(s) > 0:
	s = s[:-2]
	a = len(s)
	if s[:a // 2] * 2 == s:
		print(a)
		exit()


s = list(input())
x = (len(s) - 1) // 2
for t in range(x, 0, -1):
	if s[0:t] == s[t:2 * t]:
		print(2 * t)
		exit()


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


s = input()
temp = 1 if len(s) % 2 != 0 else 2
for i in range(temp, len(s), 2):
	moji = s[:len(s) - i]
	if moji[:len(moji) // 2] == moji[len(moji) // 2:]:
		print(len(moji))
		break


s = input()
n = len(s)

def isrepeat(s):
	res = False
	n = len(s)
	if s[0:n // 2] + s[0:n // 2] == s:
		res = True
	return res
for delnum in range(1, n):
	if (n - delnum) % 2 == 0:
		if isrepeat(s[0:n - delnum]):
			ans = n - delnum
			break
print(ans)


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


s = input()
while True:
	l = len(s)
	s = s[:l - 1]
	if len(s) % 2 != 0:
		pass
	elif s[:len(s) // 2] == s[len(s) // 2:]:
		print(len(s))
		break


import re
s = input()[:-1]
ans = re.match('(.+)\\1', s).group()
print(len(ans))