#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int base = 311;
const int mod = 1e9 + 7;
int n, in[N];
long long H[N], Pow[N];
string a;
long long get(int i, int j) {
  return (H[j] - H[i - 1] * Pow[j - i + 1] + 1ll * mod * mod) % mod;
}
void Init() {
  Pow[0] = 1;
  for (int i = 1; i <= n; ++i) {
    Pow[i] = (Pow[i - 1] * base) % mod;
    H[i] = (H[i - 1] * base + a[i - 1]) % mod;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  cin >> a;
  Init();
  in[(n + 3) / 2] = -1;
  for (int i = (n + 1) / 2; i > 0; --i) {
    int vt = n - i + 1;
    in[i] = -1;
    if (vt == i) continue;
    for (int j = in [i + 1] + 2; j > 0; j -= 2)
      if (get(i, i + j - 1) == get(vt - j + 1, vt)) {
        in[i] = j;
        break;
      }
  }
  for (int i = 1; i <= (n + 1) / 2; ++i) cout << in[i] << " ";
  return 0;
}
