#include <bits/stdc++.h>
using namespace std;
char s[1000010];
int n;
const long long mod1 = 1e7 + 9, mod2 = 1e9 + 7, base = 313;
long long hhash1[1000010], hhash2[1000010], cbase1[1000010], cbase2[1000010];
long long ans[1000010];
int main() {
  scanf("%d%s", &n, s + 1);
  hhash1[0] = hhash2[0] = 0;
  cbase1[0] = cbase2[0] = 1;
  for (int i = 1; i <= n; i++) {
    hhash1[i] = (hhash1[i - 1] * base + s[i]) % mod1;
    hhash2[i] = (hhash2[i - 1] * base + s[i]) % mod2;
    cbase1[i] = (cbase1[i - 1] * base) % mod1;
    cbase2[i] = (cbase2[i - 1] * base) % mod2;
  }
  long long mirror = (n + 1) / 2;
  int h, t;
  if (n & 1) {
    ans[mirror] = -1;
    h = t = (n + 1) / 2;
  } else {
    h = n / 2;
    t = h + 1;
    if (s[h] == s[t])
      ans[mirror] = 1;
    else
      ans[mirror] = -1;
  }
  long long l1, l2, r1, r2;
  while (mirror--) {
    ans[mirror] = ans[mirror + 1] + 2;
    h--, t++;
    while (ans[mirror] != -1) {
      l1 = (hhash1[h - 1 + ans[mirror]] -
            hhash1[h - 1] * cbase1[ans[mirror]] % mod1 + mod1) %
           mod1;
      r1 = (hhash1[t] - hhash1[t - ans[mirror]] * cbase1[ans[mirror]] % mod1 +
            mod1) %
           mod1;
      l2 = (hhash2[h - 1 + ans[mirror]] -
            hhash2[h - 1] * cbase2[ans[mirror]] % mod2 + mod2) %
           mod2;
      r2 = (hhash2[t] - hhash2[t - ans[mirror]] * cbase2[ans[mirror]] % mod2 +
            mod2) %
           mod2;
      if (l1 == r1 && l2 == r2) break;
      ans[mirror] -= 2;
    }
  }
  for (int i = 1; i <= (n + 1) / 2; i++) printf("%I64d ", ans[i]);
  printf("\n");
  return 0;
}
