#include <bits/stdc++.h>
using namespace std;
int n, r[1000006 * 4], f[1000006];
char s[1000006], S[1000006 * 4];
int min(int a, int b) { return a < b ? a : b; }
int main() {
  int i, j, k;
  scanf("%d%s", &n, s);
  S[0] = '-';
  for (i = 0; i < n * 2; i++) {
    S[i * 2 + 1] = '+';
    S[i * 2 + 2] = s[i % 2 ? n - i / 2 - 1 : i / 2];
  }
  S[n * 4 + 1] = '+';
  int mr = 0, c = 0;
  for (i = 1; i <= n * 4 + 1; i++) {
    if (i < mr) r[i] = min(r[c * 2 - i], mr - i);
    for (; S[i - r[i]] == S[i + r[i]]; r[i]++)
      ;
    if (i + r[i] > mr) mr = i + r[i], c = i;
  }
  int len, pos;
  for (i = 0; i < (n + 1) / 2; i++) f[i] = -1;
  for (i = n / 2 * 4 - 1; i > 1; i -= 4) {
    len = (r[i] + 1) / 4;
    pos = i / 4;
    if (len * 2 - 1 < n) f[pos - len + 1] = max(f[pos - len + 1], len * 2 - 1);
  }
  int ans = -1;
  for (i = 0; i < (n + 1) / 2; i++) {
    ans = max(ans - 2, f[i]);
    printf("%d ", ans);
  }
  return 0;
}
