S=eval(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()



S=eval(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()

S = eval(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()

S = eval(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()

-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]: +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]: -        print((m * 2)) +        print((N - d))