#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
const int bas1 = 31, mod1 = 998244353;
const int bas2 = 19260817, mod2 = 1e9 + 7;
int power1[MAXN], power2[MAXN];
struct hash_str {
  int hash1;
  hash_str() { hash1 = 0; }
  hash_str(char c) { hash1 = c - 'a'; }
  hash_str(int x) { hash1 = x; }
  hash_str(long long x) { hash1 = x; }
  friend hash_str operator+(const hash_str &a, const hash_str &b) {
    return (hash_str){(a.hash1 + b.hash1) % mod1};
  }
  friend hash_str operator-(const hash_str &a, const hash_str &b) {
    return (hash_str){((a.hash1 - b.hash1) % mod1 + mod1) % mod1};
  }
  hash_str shift(int x) const {
    return (hash_str){1ll * power1[x] * hash1 % mod1};
  }
  friend bool operator==(const hash_str &a, const hash_str &b) {
    return a.hash1 == b.hash1;
  }
};
hash_str hash_val[MAXN];
char str[MAXN];
int n;
int ans[MAXN];
inline hash_str query(int L, int R) {
  return hash_val[R] - hash_val[L - 1].shift(R - L + 1);
}
int query_left(int x, int y) {
  int L = 1, R = min(x, y), mid;
  while (L <= R) {
    mid = (L + R) >> 1;
    if (query(x - mid + 1, x) == query(y - mid + 1, y))
      L = mid + 1;
    else
      R = mid - 1;
  }
  return L - 1;
}
int query_right(int x, int y) {
  int L = 1, R = min(n - x + 1, n - y + 1), mid;
  while (L <= R) {
    mid = (L + R) >> 1;
    if (query(x, x + mid - 1) == query(y, y + mid - 1))
      L = mid + 1;
    else
      R = mid - 1;
  }
  return L - 1;
}
int fa[MAXN];
inline int findf(int nd) { return fa[nd] == -1 ? nd : fa[nd] = findf(fa[nd]); }
int main() {
  memset(fa, -1, sizeof fa);
  scanf("%d", &n);
  power1[0] = power2[0] = 1;
  for (int i = 1; i <= n; i++) {
    power1[i] = 1ll * power1[i - 1] * bas1 % mod1;
    power2[i] = 1ll * power2[i - 1] * bas2 % mod2;
    ans[i] = -1;
  }
  scanf("%s", str + 1);
  for (int i = 1; i <= n; i++) hash_val[i] = hash_val[i - 1].shift(1) + str[i];
  int L, R;
  if (n & 1)
    L = (n + 1) / 2 - 1, R = L + 2;
  else
    L = n / 2, R = L + 1;
  while (L >= 1) {
    if (str[L] == str[R]) {
      int x = query_left(L, R), y = query_right(L, R);
      int len = min(x, y);
      int pos = findf(L);
      while (L - pos + 1 <= len) {
        ans[pos] = 2 * (L - pos) + 1;
        fa[pos] = pos - 1;
        pos = findf(pos);
      }
    }
    L--, R++;
  }
  for (int i = 1; i <= (n + 1) / 2; i++) printf("%d ", ans[i]);
  puts("");
  return 0;
}
