#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, mod = 1e9 + 9;
int n, ans[N];
char ch[N];
class Hash {
  int P;
  unsigned long long hs[N], p[N];

 public:
  void init(int x) {
    P = x;
    for (int i = p[0] = 1; i <= n; i++)
      hs[i] = (hs[i - 1] * P + ch[i - 1]) % mod, p[i] = (p[i - 1] * P) % mod;
  }
  unsigned long long Hs(int l, int r) {
    return (hs[r] - hs[l - 1] * p[r - l + 1] % mod + mod) % mod;
  }
} h[3];
bool pd(int l, int r, int L, int R) {
  for (int i = 0; i < 3; i++)
    if (h[i].Hs(l, r) ^ h[i].Hs(L, R)) return 0;
  return 1;
}
int main() {
  int i, j, l, r, mid;
  scanf("%d%s", &n, &ch);
  h[0].init(19260817);
  h[1].init(998244353);
  h[2].init(1000000007);
  for (i = 1; i + i < n + 1; i++) {
    for (j = n - i + 1, l = 0, r = i; l < r;)
      mid = l + r + 1 >> 1,
      pd(i - mid + 1, i + mid - 1, j - mid + 1, j + mid - 1) ? l = mid
                                                             : r = mid - 1;
    if (l)
      ans[i - l + 1] =
          (ans[i - l + 1] > l * 2 - 1 ? ans[i - l + 1] : l * 2 - 1);
  }
  for (i = 1; i + i <= n + 1; i++)
    ans[i] = (ans[i] > ans[i - 1] - 2 ? ans[i] : ans[i - 1] - 2),
    ans[i] = !ans[i] ? -1 : ans[i], printf("%d ", ans[i]);
  puts("");
  return 0;
}
