#include <bits/stdc++.h>
const int MAXN = 2e6 + 5;
const int N = 26;
struct Palindromic_Tree {
  int next[MAXN][N];
  int fail[MAXN];
  int len[MAXN];
  int S[MAXN];
  int last;
  int n;
  int p;
  int newnode(int l) {
    for (int i = 0; i < N; ++i) next[p][i] = 0;
    len[p] = l;
    return p++;
  }
  void init() {
    p = 0;
    newnode(0);
    newnode(-1);
    last = 0;
    n = 0;
    S[n] = -1;
    fail[0] = 1;
  }
  int get_fail(int x) {
    while (S[n - len[x] - 1] != S[n]) x = fail[x];
    return x;
  }
  void add(int c) {
    c -= 'a';
    S[++n] = c;
    int cur = get_fail(last);
    if (!next[cur][c]) {
      int now = newnode(len[cur] + 2);
      fail[now] = next[get_fail(fail[cur])][c];
      next[cur][c] = now;
    }
    last = next[cur][c];
  }
} pam;
char str[MAXN / 2];
int id[MAXN];
int fa[MAXN];
int Find(int x) { return fa[x] == 0 ? x : fa[x] = Find(fa[x]); }
int main() {
  int len;
  scanf("%d", &len);
  scanf("%s", str + 1);
  int n = 0;
  pam.init();
  for (int i = 1; i <= len; i++) {
    pam.add(str[i]);
    id[++n] = pam.last;
    pam.add(str[len - i + 1]);
    id[++n] = pam.last;
  }
  for (int i = 1; i <= len + 1 >> 1; i++) {
    int x = id[n - (i - 1) * 2];
    while (x &&
           (pam.len[x] >= (len - (i - 1) * 2) * 2 || pam.len[x] % 4 != 2)) {
      fa[x] = Find(pam.fail[x]), x = fa[x];
    }
    printf("%d ", pam.len[x] % 4 != 2 ? -1 : pam.len[x] / 2);
  }
}
