s = list(eval(input()))

n = len(s)

while len(s) > 1:

    s.pop(-1)

    

    if len(s)%2 == 0:

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

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

        # print(s1)

        # print(s2)

        if s1 == s2:

            print((len(s)))

            exit()
s = eval(input())

n = len(s)

for i in range(n-1):

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

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

        print((len(s)))

        exit()



s = list(eval(input()))
n = len(s)
while len(s) > 1:
    s.pop(-1)
    if len(s) % 2 == 0:
        s1 = s[0 : len(s) // 2]
        s2 = s[len(s) // 2 :]
        # print(s1)
        # print(s2)
        if s1 == s2:
            print((len(s)))
            exit()

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

-s = list(eval(input())) +s = eval(input()) -while len(s) > 1: -    s.pop(-1) -    if len(s) % 2 == 0: -        s1 = s[0 : len(s) // 2] -        s2 = s[len(s) // 2 :] -        # print(s1) -        # print(s2) -        if s1 == s2: -            print((len(s))) -            exit() +for i in range(n - 1): +    s = s[: len(s) - 1] +    if s[: len(s) // 2] == s[len(s) // 2 :]: +        print((len(s))) +        exit()