#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T m, T n) {
  while (n) {
    T t = m % n;
    m = n;
    n = t;
  };
  return m;
}
template <typename T>
T exgcd(T a, T b, T& sa, T& ta) {
  T q, r, sb = 0, tb = 1, sc, tc;
  sa = 1, ta = 0;
  if (b) do
      q = a / b, r = a - q * b, a = b, b = r, sc = sa - q * sb, sa = sb,
      sb = sc, tc = ta - q * tb, ta = tb, tb = tc;
    while (b);
  return a;
}
template <typename T>
T mul_inv(T a, T b) {
  T t1 = a, t2 = b, t3;
  T v1 = 1, v2 = 0, v3;
  T x;
  while (t2 != 1)
    x = t1 / t2, t3 = t1 - x * t2, v3 = v1 - x * v2, t1 = t2, t2 = t3, v1 = v2,
    v2 = v3;
  return (v2 + b) % b;
}
template <typename T>
T powmod(T a, T b, T MOD) {
  if (b < 0) return 0;
  T rv = 1;
  while (b) (b % 2) && (rv = (rv * a) % MOD), a = a * a % MOD, b /= 2;
  return rv;
}
template <long long MOD, long long BASE, int maxn>
class StringHashOffline {
 public:
  long long h[maxn], invMod[maxn];
  StringHashOffline() {
    invMod[0] = 1;
    long long rev = mul_inv(BASE, MOD);
    invMod[1] = rev;
    for (int i = 2; i < maxn; i++) invMod[i] = (invMod[i - 1] * rev) % MOD;
  }
  void prepare(const char* s) {
    const char* sc = s;
    int i = 1;
    long long pMod = 1;
    h[0] = 0;
    while (*sc)
      pMod = (pMod * BASE) % MOD, h[i] = (h[i - 1] + (pMod * *sc)) % MOD, i++,
      sc++;
  }
  long long operator()(int fr, int to) {
    fr++, to++;
    return ((((h[to] - h[fr - 1] % MOD) * invMod[fr]) % MOD) + MOD) % MOD;
  }
};
const int maxn = 1e6 + 7;
int n;
char s[maxn];
long long res[maxn];
StringHashOffline<1000000007, 257, maxn> H1;
StringHashOffline<1000000009, 257, maxn> H2;
StringHashOffline<1000000021, 257, maxn> H3;
int main(int argc, char* argv[]) {
  std::cin.sync_with_stdio(false);
  std::cin.tie(nullptr);
  s[0] = 1;
  cin >> n >> (s + 1);
  {
    H1.prepare(s);
    H2.prepare(s);
    H3.prepare(s);
    auto check = [](int i1, int j1, int i2, int j2) {
      if (H1(i1, j1) != H1(i2, j2)) return false;
      if (H2(i1, j1) != H2(i2, j2)) return false;
      if (H3(i1, j1) != H3(i2, j2)) return false;
      return true;
    };
    int ie = (n + 1) / 2;
    int prv = -1;
    for (int i = ie, j = n + 1 - i; i >= 1 && j <= n; i--, j++) {
      long long r = -1;
      long long mx = min(prv + 2, j - i);
      if (mx % 2 == 0) mx--;
      for (int k = mx; k >= 1; k -= 2) {
        if (check(i, i + k - 1, j - k + 1, j)) {
          r = k;
          break;
        }
      }
      res[i] = prv = r;
    }
    for (int i = 1; i <= ie; i++) printf("%lld ", res[i]);
    printf("\n");
  }
  return 0;
}
