#include <bits/stdc++.h>
using namespace std;
int n;
char s[2000011];
int h1[2000011], h2[2000011], p1[2000011], p2[2000011], mod1 = 998244353,
                                                        mod2 = 1000000007;
int geth1(int L, int R) {
  return (h1[R] - h1[L - 1] * 1ll * p1[R - L + 1] % mod1 + mod1) % mod1;
}
int geth2(int L, int R) {
  return (h2[R] - h2[L - 1] * 1ll * p2[R - L + 1] % mod2 + mod2) % mod2;
}
int ans[2000011];
int main() {
  scanf("%d%s", &n, s + 1);
  h1[0] = h2[0] = 0;
  for (int i = 1; i <= n; i++)
    h1[i] = (h1[i - 1] * 27ll + s[i] - 'a' + 1) % mod1,
    h2[i] = (h2[i - 1] * 27ll + s[i] - 'a' + 1) % mod2;
  p1[0] = p2[0] = 1;
  for (int i = 1; i <= n; i++)
    p1[i] = p1[i - 1] * 27ll % mod1, p2[i] = p2[i - 1] * 27ll % mod2;
  for (int i = 0; i <= (n + 1) >> 1; i++) ans[i] = -1;
  for (int i = 1; i <= n >> 1; i++) {
    int L = 0, R = i, p = n - i + 1;
    while (L < R) {
      int mid = (L + R + 1) >> 1, a = i - mid + 1, b = i + mid - 1,
          c = p - mid + 1, d = p + mid - 1;
      if (geth1(a, b) == geth1(c, d) && geth2(a, b) == geth2(c, d))
        L = mid;
      else
        R = mid - 1;
    }
    ans[i - L + 1] = max(ans[i - L + 1], 2 * L - 1);
  }
  for (int i = 1; i <= (n + 1) >> 1; i++) {
    ans[i] = max(ans[i], ans[i - 1] - 2);
    printf("%d ", ans[i]);
  }
  return 0;
}
