#include <bits/stdc++.h>
using namespace std;
char buffer[2000020], *p1, *p2;
template <class T>
void read(T& x) {
  char ch = ((p1 == p2 &&
              (p2 = (p1 = buffer) + fread(buffer, 1, 2000020, stdin), p1 == p2))
                 ? EOF
                 : *p1++);
  x = 0;
  bool f = 1;
  while (!('0' <= ch && ch <= '9') && ch != '-')
    ch = ((p1 == p2 &&
           (p2 = (p1 = buffer) + fread(buffer, 1, 2000020, stdin), p1 == p2))
              ? EOF
              : *p1++);
  if (ch == '-')
    f = 0,
    ch = ((p1 == p2 &&
           (p2 = (p1 = buffer) + fread(buffer, 1, 2000020, stdin), p1 == p2))
              ? EOF
              : *p1++);
  while ('0' <= ch && ch <= '9')
    x = (x << 1) + (x << 3) + ch - '0',
    ch = ((p1 == p2 &&
           (p2 = (p1 = buffer) + fread(buffer, 1, 2000020, stdin), p1 == p2))
              ? EOF
              : *p1++);
  x = (f) ? x : -x;
}
int _num[20];
template <class T>
void write(T x, char sep = '\n') {
  if (!x) {
    putchar('0'), putchar(sep);
    return;
  }
  if (x < 0) putchar('-'), x = -x;
  int c = 0;
  while (x) _num[++c] = x % 10, x /= 10;
  while (c) putchar('0' + _num[c--]);
  putchar(sep);
}
int n, M[] = {19260817, 1000000007, 1000000009, 998244353}, mi[2][2000020],
       pre[2][2000020];
char s[2000020];
void hash_init() {
  for (register int i = 0; i < 2; i++) {
    mi[i][0] = 1;
    for (register int j = 1; j <= n; j++)
      mi[i][j] = mi[i][j - 1] * 2333ll % M[i];
    pre[i][0] = 0;
    for (register int j = 1; j <= n; j++)
      pre[i][j] = (pre[i][j - 1] * 2333ll + s[j]) % M[i];
  }
}
int gethash(int l, int r, int i) {
  return (pre[i][r] + M[i] - 1ll * pre[i][l - 1] * mi[i][r - l + 1] % M[i]) %
         M[i];
}
int res[2000020];
int main() {
  scanf("%d%s", &n, s + 1);
  hash_init();
  int ans = -1;
  if (!(n & 1)) ans = (s[n / 2] == s[n / 2 + 1]) ? 1 : -1;
  for (register int i = ((n + 1) >> 1) - 1; i >= 0; i--) {
    res[i + 1] = ans;
    if (!i) break;
    ans += 2;
    while (ans != -1) {
      bool f = 1;
      for (register int Mid = 0; Mid < 2; Mid++) {
        if (gethash(i, i + ans - 1, Mid) !=
            gethash(n - i + 1 - (ans - 1), n - i + 1, Mid)) {
          f = 0;
          break;
        }
      }
      if (f) break;
      ans -= 2;
    }
  }
  for (register int i = 1; i <= (n + 1) >> 1; i++) write(res[i], ' ');
  return 0;
}
