#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7, B = 1003, N = 2e6 + 5;
int n, ans[N], len[N], cs[N], power[N];
char c[N];
int hash1(int a, int len) {
  return (cs[a] - cs[a + len] * 1LL * power[len] % M + M) % M;
}
bool check(int a, int b, int mid) { return hash1(a, mid) == hash1(b, mid); }
int main() {
  scanf("%d %s", &n, &c);
  power[0] = 1;
  for (int i = 1; i < N; i++) power[i] = power[i - 1] * 1LL * B % M;
  memset(len, -1, sizeof len);
  memset(ans, -1, sizeof ans);
  for (int i = n - 1; i + 1; i--) cs[i] = (cs[i + 1] * 1LL * B % M + c[i]) % M;
  for (int i = 0; i < n / 2; i++) {
    int mi = n - i - 1;
    if (c[i] != c[mi]) continue;
    int l = 0, r = i;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (check(i - mid, mi - mid, 2 * mid + 1))
        l = mid + 1, len[i] = mid;
      else
        r = mid - 1;
    }
  }
  for (int i = 0; i < n; i++)
    if (len[i] != -1) ans[i - len[i]] = max(ans[i - len[i]], 2 * len[i] + 1);
  for (int i = 0; i < n; i++) ans[i] = max(ans[i - 1] - 2, ans[i]);
  for (int i = 0; i < (n + 1) / 2; i++) printf("%d ", ans[i]);
}
