program best_representation
  implicit none
  character(500000) :: w, r
  integer :: n, z(2,500000) = 0, i, k, p, per, m = 0
  logical :: g(2,500000) = .true.
  read(*,*) w
  n = len_trim(w)
  z(1,1:n) = z_algorithm(w)
  per = -1
  do i = n, 2, -1
    if (z(1,i)+i-1 == n .and. mod(n,z(1,i)) == 0) then
      per = z(1,i)
      exit
    end if
  end do
  if (per < 0) then
    write(*,'(i0)') 1
    write(*,'(i0)') 1
    stop
  end if
  if (per == 1) then
    write(*,'(i0)') n
    write(*,'(i0)') 1
    stop
  end if
  r = ""
  do i = 1, n
    r(i:i) = w(n-i+1:n-i+1)
  end do
  z(2,1:n) = z_algorithm(r)
  do i = 1, 2
    do p = 1, n-1
      if (.not.g(i,p)) cycle
      k = 2
      do while ((k-1)*p <= z(i,p+1))
        g(i,k*p) = .false.
        k = k+1
      end do
    end do
  end do
  g(2,1:n) = g(2,n:1:-1)
  do i = 1, n-1
    if (g(1,i) .and. g(2,i+1)) m = m+1
  end do
  write(*,'(i0)') 2
  write(*,'(i0)') m
contains
  function z_algorithm(s) result(z)
    character(*) :: s
    integer :: z(len_trim(s)), n, i, j, k
    z = 0
    n = len_trim(s)
    z(1) = n
    i = 1
    j = 0
    do while (i < n)
      do while (i+j < n .and. s(j+1:j+1) == s(i+j+1:i+j+1))
        j = j+1
      end do
      z(i+1) = j
      if (j == 0) then
        i = i+1
        cycle
      end if
      k = 1
      do while (i+k < n .and. k+z(k+1) < j)
        z(i+k+1) = z(k+1)
        k = k+1
      end do
      i = i+k
      j = j-k
    end do
  end
end program best_representation