#include <bits/stdc++.h>
using std::set;
int n, po[1000010], A[1000010], ans[1000010];
inline int a(int x, int y) {
  return ((A[y] - 1LL * A[x - 1] * po[y - x + 1] % 1061109559) + 1061109559) %
         1061109559;
}
char buf[1000010];
int main() {
  scanf("%d%s", &n, buf + 1);
  for (int i = po[0] = 1; i <= n; i++)
    po[i] = 1LL * po[i - 1] * 37 % 1061109559;
  for (int i = 1; i <= n; i++)
    A[i] = (1LL * A[i - 1] * 37 + buf[i] - 'a') % 1061109559;
  for (int i = (n + 1) >> 1, now = -1; i; i--) {
    now += 2;
    if (i * 2 > n) now = -1;
    while (~now && a(i, i + now - 1) != a(n - i - now + 2, n - i + 1)) now -= 2;
    ans[i] = now;
  }
  for (int i = 1; i <= (n + 1) >> 1; i++)
    printf("%d%c", ans[i], " \n"[i == (n + 1) >> 1]);
  return 0;
}
