#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
using namespace std;
namespace _c {
const double pi = acos(-1.0);
namespace min {
const int i8 = -128;
const int i16 = -32768;
const int i = -2147483647 - 1;
const long long l = -9223372036854775807LL - 1;
}  // namespace min
namespace max {
const int i8 = 127;
const int i16 = 32767;
const int i = 2147483647;
const long long l = 9223372036854775807LL;
}  // namespace max
}  // namespace _c
namespace _f {
template <typename T>
inline const T gcd(T m, T n) {
  while (n != 0) {
    T t = m % n;
    m = n;
    n = t;
  }
  return m;
}
template <typename T>
inline const T abs(const T &a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T pow(T a, T b) {
  T res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a;
    }
    a = a * a;
    b >>= 1;
  }
  return res;
}
template <typename T>
inline T pow(T a, T b, const T &m) {
  a %= m;
  T res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a % m;
    }
    a = a * a % m;
    b >>= 1;
  }
  return res % m;
}
}  // namespace _f
namespace io {
template <typename T>
inline T read() {
  register T res = 0, neg = 1;
  char g = getchar();
  for (; !isdigit(g); g = getchar()) {
    if (g == '-') {
      neg = -1;
    }
  }
  for (; isdigit(g); g = getchar()) {
    res = res * 10 + g - '0';
  }
  return res * neg;
}
template <typename T>
inline void read(T &t) {
  t = read<T>();
}
template <typename T>
inline void readln(const T first, const T last) {
  for (register T it = first; it != last; it++) {
    read(*it);
  }
}
template <typename T>
inline void _write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) {
    _write(x / 10);
  }
  putchar(x % 10 + '0');
}
template <typename T>
inline void write(const T &x, const char &sep = ' ') {
  _write(x);
  putchar(sep);
}
template <typename T>
inline void writeln(const T &x) {
  write(x, '\n');
}
template <typename T>
inline void writeln(const T first, const T last, const char &sep = ' ',
                    const char &ends = '\n') {
  for (register T it = first; it != last; it++) {
    write(*it, sep);
  }
  putchar(ends);
}
}  // namespace io
const int N = 1e6 + 5;
int n;
int r[N << 2], ans[N];
char s[N], S[N << 2];
int main() {
  io::read(n);
  scanf("%s", s);
  S[0] = 2;
  for (int i = 0; i < (n << 1); i++) {
    S[(i << 1) + 1] = 1;
    S[(i << 1) + 2] = s[(i & 1) ? (n - (i >> 1) - 1) : (i >> 1)];
  }
  S[(n << 2) + 1] = 1;
  int _r = 0, c = 0;
  for (int i = 1; i <= (n << 2) + 1; i++) {
    if (i < _r) {
      r[i] = std::min(r[(c << 1) - i], _r - i);
    }
    for (; S[i - r[i]] == S[i + r[i]]; r[i]++)
      ;
    if (i + r[i] > _r) {
      _r = i + r[i];
      c = i;
    }
  }
  int m = (n + 1) >> 1, p = m;
  for (int i = 0; i < m; i++) {
    ans[i] = -1;
  }
  for (int i = ((n >> 1) << 2) - 1; i > 1; i -= 4) {
    int q = (i >> 2) + 1 - ((r[i] + 1) >> 2);
    for (p = std::min(p, (i >> 2) + 1); p > q;) {
      p--;
      ans[p] = (i >> 1) - (p << 1);
    }
  }
  io::writeln(ans, ans + m);
}
