#include <bits/stdc++.h>
using namespace std;
int n, ans[1000005];
char s[1000005];
struct Hash {
  int mod = 998244353, h[1000005], pow[1000005];
  void build(char s[], int len) {
    pow[0] = 1;
    for (int i = 1; i <= len; i++) pow[i] = 26ll * pow[i - 1] % mod;
    for (int i = 1; i <= len; i++) h[i] = (26ll * h[i - 1] + s[i] - 97) % mod;
  }
  int get(int l, int len) {
    if (len <= 0) return 0;
    return 1ll * (h[l + len - 1] - 1ll * h[l - 1] * pow[len] % mod + mod) % mod;
  }
} h;
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  h.build(s, n);
  ans[(n + 3) >> 1] = -1;
  for (int i = (n + 1) >> 1, l = i, r = i + ((n & 1) ^ 1); i; i--, --l, ++r) {
    ans[i] = ans[i + 1] + 2;
    while (ans[i] >= (r - l + 1) ||
           h.get(l, ans[i]) != h.get(r - ans[i] + 1, ans[i]))
      ans[i] -= 2;
  }
  for (int i = 1; i <= ((n + 1) >> 1); i++) printf("%d ", ans[i]);
}
