#include <bits/stdc++.h>
using namespace std;
const int mod[2] = {(int)1e9 + 7, (int)1e9 + 9};
const int prime[2] = {179, 233};
const int MaxN = (int)1e6 + 9;
long long pPow[MaxN + 9][2];
long long h[MaxN + 9][2];
namespace RK {
void init(const string &s) {
  if (!pPow[0][0]) {
    pPow[0][0] = pPow[0][1] = 1;
    for (int i = 1; i <= MaxN; ++i)
      for (int z = 0; z < 2; ++z)
        pPow[i][z] = pPow[i - 1][z] * prime[z] % mod[z];
  }
  for (int i = 0; i < (int)s.size(); ++i)
    for (int z = 0; z < 2; ++z)
      h[i + 1][z] = (h[i][z] * prime[z] + s[i]) % mod[z];
}
array<long long, 2> getHash(const string &s) {
  array<long long, 2> curhash = {0, 0};
  for (int i = 0; i < (int)s.size(); ++i)
    for (int z = 0; z < 2; ++z)
      curhash[z] = (curhash[z] * prime[z] + s[i]) % mod[z];
  return curhash;
}
array<long long, 2> query(const int l, const int r) {
  array<long long, 2> res;
  for (int z = 0; z < 2; ++z) {
    res[z] = (h[r + 1][z] - h[l][z] * pPow[r - l + 1][z]) % mod[z];
    if (res[z] < 0) res[z] += mod[z];
  }
  return res;
}
}  // namespace RK
long long to_ll(array<long long, 2> a) { return ((a[0] << 32) + a[1]); }
array<long long, 2> to_arr(long long k) {
  array<long long, 2> a = {(k >> 32), k % (1 << 32)};
  return a;
}
bool isValid(const int &centeri, const int &centerj, const int &siz) {
  array<long long, 2> h1 = RK::query(centeri - siz, centeri + siz);
  array<long long, 2> h2 = RK::query(centerj - siz, centerj + siz);
  return h1 == h2;
}
int binsearch(int l, int h, const int &centeri, const int &centerj,
              const int &N) {
  if (h - l < 2) {
    if (isValid(centeri, centerj, h))
      return h;
    else
      return l;
  }
  int mid = (l + h) / 2;
  if (isValid(centeri, centerj, mid))
    return binsearch(mid, h, centeri, centerj, N);
  else
    return binsearch(l, mid, centeri, centerj, N);
}
int palin[MaxN + 9];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int N;
  cin >> N;
  string st;
  cin >> st;
  RK::init(st);
  for (int i = 0; i < N / 2; i++) {
    int centerj = N - 1 - i;
    if (st[i] == st[centerj]) {
      int bin = binsearch(0, min(i, N - 1 - i), i, centerj, N);
      palin[i - bin] = max(palin[i - bin], 2 * bin + 1);
    }
  }
  int curMax = 0;
  for (int i = 0; i < (N + 1) / 2; i++) {
    curMax = max(curMax, palin[i]);
    if (curMax > 0)
      cout << curMax << " ";
    else
      cout << "-1 ";
    curMax -= 2;
  }
  return 0;
}
