program main
  implicit none
  character(200) :: s
  integer :: n, ed
  read(*, *) s
  n = len(trim(s))
  do ed = n - 2, 2, -2
    if (is_even(s(1:ed))) then
      write(*, "(i0)") ed
      exit
    end if
  end do

  contains

  function is_even(s)
    implicit none
    character(*), intent(in) :: s
    logical :: is_even
    integer :: n, i, j
    n = len(s)
    if (mod(n, 2) == 1) then
      is_even = .false.
      return
    end if
    do i = 1, n / 2
      j = i + n / 2
      if (s(i:i) /= s(j:j)) then
        is_even = .false.
        return
      end if
    end do
    is_even = .true.
  end function is_even
end program main
