s = list(eval(input()))



for i in range(1,len(s)):

    len_s = len(s) - 2 * i

    for j in range(1,len(s)):

        left = s[0:j]

        right = s[j:len_s]

        if left == right:

            ans = len(left + right)

            print(ans)

            exit()

        elif len(left) > len(right):

            break
s = eval(input())



for i in range(len(s)//2):

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

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

        print((len(s)))

        exit()
s = list(eval(input()))
for i in range(1, len(s)):
    len_s = len(s) - 2 * i
    for j in range(1, len(s)):
        left = s[0:j]
        right = s[j:len_s]
        if left == right:
            ans = len(left + right)
            print(ans)
            exit()
        elif len(left) > len(right):
            break

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

-s = list(eval(input())) -for i in range(1, len(s)): -    len_s = len(s) - 2 * i -    for j in range(1, len(s)): -        left = s[0:j] -        right = s[j:len_s] -        if left == right: -            ans = len(left + right) -            print(ans) -            exit() -        elif len(left) > len(right): -            break +s = eval(input()) +for i in range(len(s) // 2): +    s = s[: len(s) - 2] +    if s[: len(s) // 2] == s[len(s) // 2 :]: +        print((len(s))) +        exit()