#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 50;
const int INF = 0x3f3f3f3f;
int len[MAXN], fail[MAXN], nxt[MAXN][26];
int last, tot;
int id[MAXN], pre[MAXN];
char ss[MAXN >> 1], s[MAXN];
inline void Init() {
  len[0] = 0, len[1] = -1;
  fail[0] = fail[1] = 1;
  last = tot = 1;
}
inline void Insert(int x, int en) {
  int p = last;
  while (s[en] != s[en - len[p] - 1]) p = fail[p];
  if (!nxt[p][x]) {
    int np = ++tot;
    len[np] = len[p] + 2;
    int tmp = fail[p];
    while (s[en] != s[en - len[tmp] - 1]) tmp = fail[tmp];
    fail[np] = nxt[tmp][x];
    nxt[p][x] = np;
  }
  last = nxt[p][x];
  id[en] = last;
}
int Find(int x) { return x == pre[x] ? pre[x] : pre[x] = Find(pre[x]); }
int main() {
  int n, k = 0;
  scanf("%d", &n);
  scanf("%s", ss);
  Init();
  for (int i = 0, j = n - 1; i < n; i++, j--) s[++k] = ss[i], s[++k] = ss[j];
  for (int i = 1; i <= k; i++) Insert(s[i] - 'a', i);
  for (int i = 0; i <= tot; i++) pre[i] = i;
  for (int i = 1; i <= (n + 1) / 2; i++) {
    int x = Find(id[k - ((i - 1) << 1)]);
    while (x != 1 && ((len[x] >> 1) >= (n - ((i - 1) << 1)) || len[x] % 4 != 2))
      x = pre[x] = Find(fail[pre[x]]);
    printf("%d ", (len[x] % 4 == 2 ? (len[x] >> 1) : -1));
  }
  return 0;
}
