#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast,no-stack-protector")
using namespace std;
function<void(void)> ____ = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
};
template <typename T>
vector<T> &operator<<(vector<T> &__container, T x) {
  __container.push_back(x);
  return __container;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &__container) {
  for (T _ : __container) out << _ << ' ';
  return out;
}
const int MAXN = 1e6 + 7;
const int MOD1 = 998244353;
const int MOD2 = 1004525809;
const int BASE1 = 233;
const int BASE2 = 1033;
int n, pw1[MAXN], pw2[MAXN], ret[MAXN];
pair<int, int> hax[MAXN];
char s[MAXN];
pair<int, int> calc(int l, int r) {
  return make_pair(
      (hax[r].first - 1ll * hax[l - 1].first * pw1[r - l + 1] % MOD1 + MOD1) %
          MOD1,
      (hax[r].second - 1ll * hax[l - 1].second * pw2[r - l + 1] % MOD2 + MOD2) %
          MOD2);
}
void solve() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  pw1[0] = pw2[0] = 1;
  for (int i = 1; i < MAXN; i++)
    pw1[i] = 1ll * pw1[i - 1] * BASE1 % MOD1,
    pw2[i] = 1ll * pw2[i - 1] * BASE2 % MOD2;
  for (int i = 1; i <= n; i++) {
    hax[i].first = (1ll * hax[i - 1].first * BASE1 + s[i]) % MOD1;
    hax[i].second = (1ll * hax[i - 1].second * BASE2 + s[i]) % MOD2;
  }
  memset(ret, 255, sizeof(ret));
  for (int i = 1; i <= (n >> 1); i++) {
    int l = 1, r = i;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (calc(i - mid + 1, i + mid - 1) ==
          calc(n - i + 1 - mid + 1, n - i + 1 + mid - 1))
        l = mid + 1;
      else
        r = mid - 1;
    }
    ret[i - r + 1] = r * 2 - 1;
  }
  for (int i = 1; i <= (n + 1) / 2; i++)
    cout << (ret[i] = max(ret[i], ret[i - 1] - 2)) << ' ';
  cout << "\n";
}
int main() {
  solve();
  return 0;
}
