#include <bits/stdc++.h>
using namespace std;
long long f[2000005], p[2000005], sum[2000005], ans[1000002], cnt;
const long long mod1 = 998244353;
int n;
char s[2000005];
inline void solve() {
  sum[0] = 1;
  for (int i = 1; i <= n; ++i) {
    f[i] = (f[i - 1] * 131 + s[i]) % mod1;
    sum[i] = (sum[i - 1] * 131) % mod1;
  }
  int l, r;
  cnt = (n + 1) >> 1;
  if (n & 1) {
    ans[cnt] = -1;
    l = r = (n + 1) >> 1;
  } else {
    l = n >> 1;
    r = l + 1;
    ans[cnt] = s[l] == s[r] ? 1 : -1;
  }
  long long p, q;
  while (cnt--) {
    ans[cnt] = ans[cnt + 1] + 2;
    if (!cnt) break;
    l--;
    r++;
    p = -1;
    q = 1;
    while (ans[cnt] != -1) {
      p = (f[l + ans[cnt] - 1] - f[l - 1] * sum[ans[cnt]] % mod1 + mod1) % mod1;
      q = (f[r] - f[r - ans[cnt]] * sum[ans[cnt]] % mod1 + mod1) % mod1;
      if (p == q) break;
      ans[cnt] -= 2;
    }
  }
  for (int i = 1; i <= (n + 1) >> 1; ++i) printf("%lld ", ans[i]);
}
int main() {
  scanf("%d%s", &n, s + 1);
  solve();
  return 0;
}
