#include <bits/stdc++.h>
using namespace std;
const int Max_N(1000050);
int N, Log[Max_N];
struct Str {
  char S[Max_N];
  int SA[Max_N], Rank[Max_N], Height[Max_N], ST[20][Max_N];
  void getSA() {
    static int wa[Max_N], wb[Max_N], Cnt[Max_N];
    int *x = wa, *y = wb, M = 128;
    memset(Cnt, 0, sizeof(Cnt));
    for (int i = 1; i <= N; ++i) ++Cnt[x[i] = S[i]];
    for (int i = 1; i <= M; ++i) Cnt[i] += Cnt[i - 1];
    for (int i = N; i >= 1; --i) SA[Cnt[x[i]]--] = i;
    for (int k = 1; k <= N; k <<= 1) {
      int p(0);
      for (int i = N - k + 1; i <= N; ++i) y[++p] = i;
      for (int i = 1; i <= N; ++i)
        if (SA[i] > k) y[++p] = SA[i] - k;
      memset(Cnt, 0, sizeof(Cnt));
      for (int i = 1; i <= N; ++i) ++Cnt[x[i]];
      for (int i = 1; i <= M; ++i) Cnt[i] += Cnt[i - 1];
      for (int i = N; i >= 1; --i) SA[Cnt[x[y[i]]]--] = y[i];
      swap(x, y), x[SA[1]] = (p = 1);
      for (int i = 2; i <= N; ++i) {
        if (y[SA[i - 1]] != y[SA[i]] || y[SA[i - 1] + k] != y[SA[i] + k]) ++p;
        x[SA[i]] = p;
      }
      if ((M = p) == N) break;
    }
    for (int i = 1; i <= N; ++i) Rank[SA[i]] = i;
    for (int i = 1, j, k = 0; i <= N; ++i) {
      if (k) --k;
      j = SA[Rank[i] - 1];
      while (S[i + k] == S[j + k]) ++k;
      Height[Rank[i]] = k;
    }
    for (int i = 1; i <= N; ++i) ST[0][i] = Height[i];
    for (int j = 1; (1 << j) <= N; ++j)
      for (int i = 1; i <= N; ++i)
        ST[j][i] = min(ST[j - 1][i], ST[j - 1][i + (1 << (j - 1))]);
  }
  inline int rmq(int l, int r) {
    int k = Log[r - l + 1];
    return min(ST[k][l], ST[k][r - (1 << k) + 1]);
  }
  inline int LCP(int a, int b) {
    return a == b ? N - a + 1
                  : rmq(min(Rank[a], Rank[b]) + 1, max(Rank[a], Rank[b]));
  }
};
Str A, B;
vector<pair<int, int>> V[Max_N];
set<int> S;
int main() {
  scanf("%d", &N);
  for (int i = 2; i <= N; ++i) Log[i] = Log[i >> 1] + 1;
  scanf("%s", A.S + 1);
  for (int i = 1; i <= N; ++i) B.S[N - i + 1] = A.S[i];
  A.getSA(), B.getSA();
  for (int i = 1, j, l; i <= N / 2; ++i) {
    if (A.S[i] != A.S[j = N - i + 1]) continue;
    l = min(A.LCP(i, j), B.LCP(i, j));
    V[i - l + 1].push_back(make_pair(i, +1));
    V[i + 1].push_back(make_pair(i, -1));
  }
  for (int i = 1; i <= (N + 1) / 2; ++i) {
    for (int j = 0; j != V[i].size(); ++j)
      if (V[i][j].second == +1)
        S.insert(V[i][j].first);
      else
        S.erase(V[i][j].first);
    if (S.empty())
      printf("-1 ");
    else
      printf("%d ", (*S.rbegin() - i + 1) * 2 - 1);
  }
  return 0;
}
