#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
const long long B = 233, mod = 1e9 + 7;
char s[N];
int n, cnt, l, r, ans[N];
long long h[N], p[N] = {1ll};
long long gethash(int l, int r) {
  return ((h[r] - h[l - 1] * p[r - l + 1]) % mod + mod) % mod;
}
int main() {
  scanf("%d", &n);
  getchar();
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    p[i] = p[i - 1] * B % mod;
    h[i] = (h[i - 1] * B % mod + s[i]) % mod;
  }
  cnt = n + 1 >> 1;
  if (n & 1)
    ans[cnt] = -1, l = r = cnt;
  else {
    l = cnt, r = cnt + 1;
    if (s[l] == s[r])
      ans[cnt] = 1;
    else
      ans[cnt] = -1;
  }
  for (int i = cnt - 1; i > 0; i--) {
    l--, r++;
    for (int j = ans[i + 1] + 2; j >= -1; j -= 2) {
      if (j == -1 || gethash(l, l + j - 1) == gethash(r - j + 1, r)) {
        ans[i] = j;
        break;
      }
    }
  }
  for (int i = 1; i <= cnt; i++) printf("%d ", ans[i]);
  return 0;
}
