s = list(str(eval(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()

s = list(str(eval(input())))

for i in range(len(s)):

    s.pop()

    if len(s)%2 == 1:

        continue

    t = s[0:len(s)//2]

    u = s[len(s)//2:]

    t = ''.join(t)

    u = ''.join(u)

    if t == u:

        print((len(s)))

        exit()

s = list(str(eval(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()

s = list(str(eval(input())))
for i in range(len(s)):
    s.pop()
    if len(s) % 2 == 1:
        continue
    t = s[0 : len(s) // 2]
    u = s[len(s) // 2 :]
    t = "".join(t)
    u = "".join(u)
    if t == u:
        print((len(s)))
        exit()

-n = len(s) -for i in range(n): +for i in range(len(s)): -    # print(''.join(s)) -    if len(s) % 2 != 0: +    if len(s) % 2 == 1: -    else: -        if s[0 : len(s) // 2] * 2 == s: -            # print(''.join(s)) -            print((len(s))) -            exit() +    t = s[0 : len(s) // 2] +    u = s[len(s) // 2 :] +    t = "".join(t) +    u = "".join(u) +    if t == u: +        print((len(s))) +        exit()