#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int base = 131;
const long long mod = 1e9 + 7;
char s[N];
int n;
long long Hash[N], sum[N];
int ans[N];
void init() {
  for (int i = 1; i <= n; i++)
    Hash[i] = (Hash[i - 1] * base % mod + s[i]) % mod;
  sum[0] = 1;
  for (int i = 1; i <= n; i++) sum[i] = (sum[i - 1] * base) % mod;
}
bool check(int i, int len) {
  int l = i, r = i + len - 1;
  long long now1 = (Hash[r] - Hash[l - 1] * sum[len] % mod + mod) % mod;
  r = n + 1 - i;
  l = r - len + 1;
  long long now2 = (Hash[r] - Hash[l - 1] * sum[len] % mod + mod) % mod;
  if (now1 == now2) return 1;
  return 0;
}
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  init();
  int cnt = (n + 1) >> 1;
  if (n % 2)
    ans[cnt] = -1;
  else {
    if (s[cnt] != s[cnt + 1])
      ans[cnt] = -1;
    else
      ans[cnt] = 1;
  }
  for (int i = cnt - 1; i >= 1; i--) {
    int len = ans[i + 1] + 2;
    while (len != -1) {
      if (check(i, len)) {
        ans[i] = len;
        break;
      }
      len -= 2;
    }
    if (!ans[i]) ans[i] = -1;
  }
  for (int i = 1; i <= cnt; i++) {
    if (i != 1) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
