#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const double Pi = acos(-1);
bool inline equ(double a, double b) { return fabs(a - b) < EPS; }
int _R(int &x) { return scanf("%d", &x); }
int _R(long long &x) { return scanf("%" PRId64, &x); }
int _R(double &x) { return scanf("%lf", &x); }
int _R(char *s) { return scanf("%s", s); }
int _R(char c) { return scanf("%c", &c); }
int R() { return 0; }
template <typename T, typename... U>
int R(T &x, U &...tail) {
  return _R(x) + R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%" PRId64, x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
const int N = 1e6 + 10;
const int MOD1 = 1e9 + 7;
const int MOD2 = 1e9 + 9;
const int B = 13131;
inline int add(int a, int b, int mod) {
  a += b;
  return a >= mod ? a - mod : a;
}
inline int sub(int a, int b, int mod) {
  a -= b;
  return a < 0 ? a + mod : a;
}
inline int mul(long long a, int b, int mod) {
  a *= b;
  return a >= mod ? a % mod : a;
}
inline pair<int, int> add(pair<int, int> a, pair<int, int> b) {
  return {add(a.first, b.first, MOD1), add(a.second, b.second, MOD2)};
}
inline pair<int, int> sub(pair<int, int> a, pair<int, int> b) {
  return {sub(a.first, b.first, MOD1), sub(a.second, b.second, MOD2)};
}
inline pair<int, int> mul(pair<int, int> a, pair<int, int> b) {
  return {mul(a.first, b.first, MOD1), mul(a.second, b.second, MOD2)};
}
int n;
char ip[N];
pair<int, int> pw[N];
pair<int, int> hsh[N];
inline pair<int, int> get(int l, int r) {
  return sub(hsh[r], mul(pw[r - l + 1], hsh[l - 1]));
}
inline int f(int l, int r, int ub) {
  ub = min(ub, (r - l + 1) - 1);
  for (int len = (ub); len >= (1); len--)
    if (len % 2) {
      pair<int, int> lft = get(l, l + len - 1);
      pair<int, int> rgt = get(r - len + 1, r);
      if (lft == rgt) return len;
    }
  return -1;
}
int ans[N];
void solve() {
  ans[0] = n;
  for (int i = ((n + 1) / 2); i >= (1); i--) {
    ans[i] = f(i, n - i + 1, ans[i + 1] + 2);
  }
  for (int i = (1); i <= ((n + 1) / 2); i++)
    printf("%d%c", ans[i], " \n"[i == (n + 1) / 2]);
}
int main() {
  scanf("%d%s", &n, ip + 1);
  pw[0] = {1, 1};
  for (int i = (1); i <= (n); i++) {
    pw[i] = mul({B, B}, pw[i - 1]);
    hsh[i] = add({ip[i], ip[i]}, mul({B, B}, hsh[i - 1]));
  }
  solve();
}
