#include <bits/stdc++.h>
using namespace std;
const int N = 1000 * 1000 + 123;
int n;
char s[N];
long long h[N];
long long pr = 31, inv_pr;
long long pr_pow[N];
long long inv_pr_pow[N];
long long MOD = 1000 * 1000 * 1000 + 7;
int ans[N];
long long bin_pow(long long base, long long exp) {
  if (exp == 0) return 1;
  long long h = bin_pow(base, exp / 2);
  h = (h * h) % MOD;
  if (exp % 2 == 0) return h;
  return (h * base) % MOD;
}
long long inv(long long x) { return bin_pow(x, MOD - 2); }
long long hsh(int l, int r) {
  return ((h[r] - h[l - 1] + MOD) * inv_pr_pow[l - 1]) % MOD;
}
bool eq(int ci, int l) {
  int rci = n - ci + 1;
  return hsh(ci - l, ci + l) == hsh(rci - l, rci + l);
}
int main() {
  scanf("%d%s", &n, s + 1);
  pr_pow[0] = 1;
  inv_pr = inv(pr);
  inv_pr_pow[0] = 1;
  for (int i = 1; i < N; i++) {
    ans[i] = -1;
    (pr_pow[i] = pr_pow[i - 1] * pr) %= MOD;
    (inv_pr_pow[i] = inv_pr_pow[i - 1] * inv_pr) %= MOD;
  }
  h[0] = 0;
  for (int i = 1; i <= n; i++) {
    (h[i] = h[i - 1] + (s[i] - 'a' + 1) * pr_pow[i]) %= MOD;
  }
  for (int i = 1; i <= (n + 1) / 2; i++) {
    int L = 0, R = i - 1, mid;
    while (L < R) {
      mid = (L + R + 1) / 2;
      if (eq(i, mid))
        L = mid;
      else
        R = mid - 1;
    }
    if (L == 0 && s[i] != s[n - i + 1]) continue;
    if (2 * L + 1 < n - 2 * (i - L - 1))
      ans[i - L] = max(ans[i - L], 2 * L + 1);
  }
  for (int i = 2; i <= (n + 1) / 2; i++) {
    ans[i] = max(ans[i], ans[i - 1] - 2);
  }
  for (int i = 1; i <= (n + 1) / 2; i++) {
    cout << ans[i] << ' ';
  }
  return 0;
}
