#include <bits/stdc++.h>
using namespace std;
int R[4444444], droit, milieu;
char _ss[1000010], _s[2333333], s[4444444];
const int T = 524288;
inline int gmax(register int a, register int b) { return a > b ? a : b; }
inline int gmin(register int a, register int b) { return a < b ? a : b; }
int f[1111111];
void C(int l, int r, int x) {
  for (l += T - 1, r += T + 1; l ^ r ^ 1; l >>= 1, r >>= 1)
    l & 1 ?: f[l ^ 1] = gmax(f[l], x), ~r & 1 ?: f[r ^ 1] = gmax(f[r], x);
}
int Q(int l) {
  int r = -1;
  for (l += T; l; l >>= 1) r = gmax(r, f[l]);
  return r;
}
int main() {
  int n, nn;
  memset(f, -1, sizeof(f));
  !scanf("%d%s", &n, _ss);
  nn = n;
  for (int i = 0; i < n; i++) {
    _s[i * 2] = _ss[i];
    _s[2 * n - i * 2 - 1] = _ss[i];
  }
  n *= 2;
  for (int i = 0; i < n; i++) {
    s[i * 2 + 1] = _s[i];
    s[i * 2] = '$';
  }
  s[0] = '#';
  n = 2 * n - 1;
  R[1] = 0;
  droit = 1;
  milieu = 1;
  for (int i = 2; i <= n / 2; i++) {
    if (i > droit) {
      for (R[i] = 1; s[i - R[i]] == s[i + R[i]]; R[i]++)
        ;
      R[i]--;
      milieu = i;
      droit = i + R[i];
    } else {
      int j = milieu * 2 - i;
      if (j - R[j] <= milieu * 2 - droit) {
        for (R[i] = gmin(R[j], j - milieu * 2 + droit) + 1;
             s[i - R[i]] == s[i + R[i]]; R[i]++)
          ;
        R[i]--;
        milieu = i;
        droit = i + R[i];
      } else
        R[i] = R[j];
    }
    if (~i & 1 && i >> 1 & 1) {
      if (R[i] == 0) continue;
      int r = (i + 2) / 4, l = r - ((R[i] + 1) / 2 - 1) / 2;
      if (r > (nn + 1) / 2) r = (nn + 1) / 2;
      if (l <= r) C(l, r, r);
    }
  }
  for (int i = 1; i <= nn + 1 >> 1; i++) {
    int res = Q(i);
    printf("%d ", res > 0 ? 2 * (res - i) + 1 : -1);
  }
  return 0;
}
