# ABC066 B - ss

S = eval(input())

N = len(S)

ans = 0

for i in range(1,N):

    ss = S[0:N-i]

    if len(ss)%2 == 1:

        continue

    n = len(ss)//2

    sf = ss[0:n]

    st = ss[n:N+1]

    if sf == st:

        ans = max(ans,len(ss))



print(ans)
s=eval(input())

n=len(s)

for i in range(n-1,1,-1):

    t=s[:i]

    nt=len(t)

    if nt%2==1:

        continue

    if t[nt//2:]==t[:nt//2]:

        print(nt)

        exit()
# ABC066 B - ss
S = eval(input())
N = len(S)
ans = 0
for i in range(1, N):
    ss = S[0 : N - i]
    if len(ss) % 2 == 1:
        continue
    n = len(ss) // 2
    sf = ss[0:n]
    st = ss[n : N + 1]
    if sf == st:
        ans = max(ans, len(ss))
print(ans)

s = eval(input())
n = len(s)
for i in range(n - 1, 1, -1):
    t = s[:i]
    nt = len(t)
    if nt % 2 == 1:
        continue
    if t[nt // 2 :] == t[: nt // 2]:
        print(nt)
        exit()

-# ABC066 B - ss -S = eval(input()) -N = len(S) -ans = 0 -for i in range(1, N): -    ss = S[0 : N - i] -    if len(ss) % 2 == 1: +s = eval(input()) +n = len(s) +for i in range(n - 1, 1, -1): +    t = s[:i] +    nt = len(t) +    if nt % 2 == 1: -    n = len(ss) // 2 -    sf = ss[0:n] -    st = ss[n : N + 1] -    if sf == st: -        ans = max(ans, len(ss)) -print(ans) +    if t[nt // 2 :] == t[: nt // 2]: +        print(nt) +        exit()