#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int n, cnt, l, r, ans[N], bas = 131;
long long p[N], sum[N], mod = 998244353;
char s[N];
long long calc(int l, int r) {
  return (sum[r] - sum[l - 1] * p[r - l + 1] % mod + mod) % mod;
}
int main() {
  scanf("%d%s", &n, s + 1);
  p[0] = 1;
  for (int i = 1; i <= n; i++) {
    p[i] = p[i - 1] * bas % mod;
    sum[i] = (sum[i - 1] * bas % mod + s[i] - 'a' + 1) % mod;
  }
  cnt = (n + 1) / 2;
  if (n % 2 == 1) {
    l = r = cnt;
    ans[cnt] = -1;
  } else {
    l = n / 2, r = l + 1;
    if (s[l] == s[r])
      ans[cnt] = 1;
    else
      ans[cnt] = -1;
  }
  for (int i = cnt - 1; i >= 1; i--) {
    l--, r++;
    for (int j = ans[i + 1] + 2; j >= -1; j -= 2) {
      long long x = calc(l, l + j - 1), y = calc(r - j + 1, r);
      if (x == y || j == -1) {
        ans[i] = j;
        break;
      }
    }
  }
  for (int i = 1; i <= cnt; i++) printf("%d ", ans[i]);
  return 0;
}
