#include <bits/stdc++.h>
using namespace std;
long long const M = 1e6 + 10, M2 = 1000 + 10, inf = 2e9 + 10, mod = 1e9 + 7;
long long hsh[M], pw[M], n, ans[M];
string x;
bool bad(long long t) {
  if (t < 0 || t >= (long long)x.size()) return 1;
  return 0;
}
long long get(long long l, long long r) {
  long long tmp;
  if (l == 0)
    tmp = 0;
  else
    tmp = hsh[l - 1] * pw[r - l + 1], tmp %= mod;
  long long an = hsh[r] - tmp;
  an += mod;
  an %= mod;
  return an;
}
bool check(long long l1, long long r1, long long l2, long long r2) {
  if (bad(l1) || bad(r1) || bad(l2) || bad(r2)) return 0;
  return (get(l1, r1) == get(l2, r2));
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pw[0] = 1;
  for (long long i = 1; i <= 1e6; i++) pw[i] = pw[i - 1] * 31, pw[i] %= mod;
  cin >> n;
  cin >> x;
  for (long long i = 0; i <= ((long long)x.size() - 1) / 2; i++) ans[i] = -1;
  for (long long i = 0; i < x.size(); i++) {
    if (i == 0)
      hsh[i] = (x[i] - 'a' + 1);
    else
      hsh[i] = hsh[i - 1] * 31 + (x[i] - 'a' + 1);
    hsh[i] %= mod;
  }
  for (long long i = 0; i < (long long)x.size() / 2; i++) {
    long long j = (long long)x.size() - i - 1;
    if (x[j] != x[i]) continue;
    long long lo = 0, hi = x.size();
    while (hi > lo + 1) {
      long long mid = (lo + hi) >> 1;
      if (check(i - mid, i + mid, j - mid, j + mid))
        lo = mid;
      else
        hi = mid - 1;
    }
    long long good = lo;
    if (check(i - hi, i + hi, j - hi, j + hi)) good = hi;
    ans[i - good] = 2 * good + 1;
  }
  for (long long i = 0; i <= ((long long)x.size() - 1) / 2; i++) {
    ans[i] = max(ans[i - 1] - 2, ans[i]);
    cout << ans[i] << " ";
  }
}
