#include <bits/stdc++.h>
using namespace std;
pair<vector<int>, vector<int>> sa_db(const string s) {
  int n = s.size();
  vector<int> sa(n), ra(n), t(n);
  for (int i = 0; i < n; ++i) ra[sa[i] = i] = s[i];
  for (int h = 1; t[n - 1] != n - 1; h *= 2) {
    auto cmp = [&](int i, int j) {
      if (ra[i] != ra[j]) return ra[i] < ra[j];
      return i + h < n && j + h < n ? ra[i + h] < ra[j + h] : i > j;
    };
    sort(sa.begin(), sa.end(), cmp);
    for (int i = 0; i + 1 < n; ++i) t[i + 1] = t[i] + cmp(sa[i], sa[i + 1]);
    for (int i = 0; i < n; ++i) ra[sa[i]] = t[i];
  }
  return {sa, ra};
}
vector<int> build_lcp(string &s, vector<int> &sa, vector<int> &ra) {
  int n = s.size();
  vector<int> lcp(n);
  for (int i = 0, h = 0; i < n; ++i) {
    if (ra[i] == 0) continue;
    if (h > 0) --h;
    for (int j = sa[ra[i] - 1]; max(j, i) + h < n; ++h) {
      if (s[j + h] != s[i + h]) break;
    }
    lcp[ra[i] - 1] = h;
  }
  return lcp;
}
vector<int> build_lcp_rmq(const vector<int> &lcp) {
  vector<int> sgt(lcp.size() << 2);
  function<void(int, int, int)> build = [&](int t, int lb, int rb) {
    if (rb - lb == 1) return sgt[t] = lcp[lb], void();
    int mb = lb + rb >> 1;
    build(t << 1, lb, mb);
    build(t << 1 | 1, mb, rb);
    sgt[t] = min(sgt[t << 1], sgt[t << 1 | 1]);
  };
  build(1, 0, lcp.size());
  return sgt;
}
vector<vector<int>> build_lcp_sparse_table(const vector<int> &lcp) {
  int n = lcp.size(), lg = 31 - __builtin_clz(n);
  vector<vector<int>> st(lg + 1, vector<int>(n));
  for (int i = 0; i < n; ++i) st[0][i] = lcp[i];
  for (int j = 1; (1 << j) <= n; ++j)
    for (int i = 0; i + (1 << j) <= n; ++i)
      st[j][i] = min(st[j - 1][i], st[j - 1][i + (1 << (j - 1))]);
  return st;
}
int sparse_rmq(int L, int R, int n, vector<vector<int>> &st) {
  int k = 31 - __builtin_clz(R - L);
  return min(st[k][L], st[k][R - (1 << k)]);
}
int LCA(int i, int j, const vector<int> &ra, const vector<int> &lcp_seg) {
  if (ra[i] > ra[j]) swap(i, j);
  function<int(int, int, int, int, int)> query = [&](int L, int R, int l, int r,
                                                     int v) {
    if (L <= l and r <= R) return lcp_seg[v];
    int m = l + r >> 1, ans = 1e9;
    if (L < m) ans = min(ans, query(L, R, l, m, v << 1));
    if (m < R) ans = min(ans, query(L, R, m, r, v << 1 | 1));
    return ans;
  };
  return query(ra[i], ra[j], 0, ra.size(), 1);
}
int ans[1000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  fill(ans, ans + n, -1);
  vector<int> ra, sa, lcp;
  tie(sa, ra) = sa_db(s), lcp = build_lcp(s, sa, ra);
  auto st = build_lcp_sparse_table(lcp);
  for (int i = 0; i < n / 2; ++i) {
    int l = 0, r = i + 1;
    if (i == n - 1 - i) --r;
    if (s[i] != s[n - 1 - i]) continue;
    while (r - l > 1) {
      int m = r + l >> 1, a = i - m, b = n - 1 - i - m;
      if (ra[a] > ra[b]) swap(a, b);
      if (sparse_rmq(ra[a], ra[b], n, st) >= 2 * m + 1)
        l = m;
      else
        r = m;
    }
    ans[i - l] = max(2 * l + 1, ans[i - 1]);
  }
  for (int i = 1; i < (n + 1) / 2; ++i) ans[i] = max(ans[i - 1] - 2, ans[i]);
  for (int i = 0; i < (n + 1) / 2; ++i)
    cout << ans[i] << " \n"[i == (n + 1) / 2 - 1];
}
