#include <bits/stdc++.h>
using namespace std;
int pct(int x) { return __builtin_popcount(x); }
int pct(long long x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); }
int bt(long long x) { return 63 - __builtin_clzll(x); }
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
long long cdiv(long long a, long long b) {
  return a / b + !(a < 0 || a % b == 0);
}
int nxt_C(int x) {
  int c = x & -x, r = x + c;
  return (((r ^ x) >> 2) / c) | r;
}
long long nxt_C(long long x) {
  long long c = x & -x, r = x + c;
  return (((r ^ x) >> 2) / c) | r;
}
vector<int> get_bits(int mask) {
  vector<int> bb;
  while (mask) {
    int b = bt(mask);
    bb.push_back(b);
    mask ^= (1 << b);
  }
  reverse(bb.begin(), bb.end());
  return bb;
}
int get_mask(vector<int> v) {
  int mask = 0;
  for (int x : v) {
    mask ^= (1 << x);
  }
  return mask;
}
template <typename T>
void uniq(vector<T> &v) {
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
}
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand(long long l, long long r) {
  uniform_int_distribution<long long> uid(l, r);
  return uid(rng);
}
void sc() {}
template <typename Head, typename... Tail>
void sc(Head &H, Tail &...T) {
  cin >> H;
  sc(T...);
}
const int mod = 1e9 + 7;
int pwr(int a, long long b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (ans * 1LL * a) % mod;
    a = (a * 1LL * a) % mod;
    b >>= 1;
  }
  return ans;
}
const int N = 2e6 + 5;
vector<int> sufflink;
vector<unordered_map<char, int>> nxt;
forward_list<int> lol[N], g[N];
int len[N];
struct Palindromic_Tree {
  int num;
  int suff;
  string s;
  int cur, curlen;
  inline int get(int &u, char &ch) {
    if (nxt[u].count(ch)) return nxt[u][ch];
    return 0;
  }
  bool add(int pos) {
    cur = suff, curlen = 0;
    char ch = s[pos];
    while (true) {
      curlen = len[cur];
      if (pos - 1 - curlen >= 0 && s[pos - 1 - curlen] == s[pos]) break;
      cur = sufflink[cur];
    }
    if (nxt[cur].count(ch)) {
      suff = nxt[cur][ch];
      return false;
    }
    num++;
    suff = num;
    len[num] = len[cur] + 2;
    nxt[cur][ch] = num;
    if (len[num] == 1) {
      sufflink[num] = 2;
      return true;
    }
    while (true) {
      cur = sufflink[cur];
      curlen = len[cur];
      if (pos - 1 - curlen >= 0 && s[pos - 1 - curlen] == s[pos]) {
        sufflink[num] = get(cur, ch);
        break;
      }
    }
    return true;
  }
  void initTree() {
    num = 2;
    suff = 2;
    len[1] = -1;
    sufflink[1] = 1;
    len[2] = 0;
    sufflink[2] = 1;
  }
  void compute(string &ss) {
    sufflink.resize((int)ss.size() + 5);
    nxt.resize((int)ss.size() + 5);
    s = ss;
    initTree();
    int n = (int)s.size();
    for (int i = 0; i <= n - 1; i++) {
      add(i);
      if (i >= (int)ss.size() / 2) lol[suff].push_front(i);
    }
    for (int i = 2; i <= num; i++) g[sufflink[i]].push_front(i);
    sufflink.clear();
    sufflink.shrink_to_fit();
    nxt.clear();
    nxt.shrink_to_fit();
  }
};
Palindromic_Tree P;
int cur_len[N], ans[N >> 1];
int n, tot = 0;
int *it, l;
void dfs(int u) {
  bool gg = 0;
  if (len[u] > 0 && !(len[u] & 1) && ((len[u] >> 1) & 1)) gg = 1;
  if (gg) cur_len[tot++] = len[u] >> 1;
  int i;
  for (auto &i : lol[u]) {
    if (((i - n + 1) & 1) == (n & 1)) {
      l = (i - n + 1);
      it = upper_bound(cur_len, cur_len + tot, l);
      if (n & 1) it = lower_bound(cur_len, cur_len + tot, l);
      if (it != cur_len) {
        it--;
        ans[(i - n) / 2] = *it;
      }
    }
  }
  lol[u].clear();
  int v;
  for (auto &v : g[u]) {
    dfs(v);
  }
  g[u].clear();
  if (gg) tot--;
}
void solve() {
  memset(ans, -1, sizeof ans);
  string t = "";
  n = 1e6;
  sc(n);
  sc(t);
  string s = "";
  for (int i = 0; i < (n >> 1); i++) {
    s += t[i];
    s += t[n - 1 - i];
  }
  if (n & 1) s += t[n >> 1];
  string ss = s;
  reverse(ss.begin(), ss.end());
  s += ss;
  P.compute(s);
  dfs(1);
  for (int i = (n + 1) / 2; i >= 1; i--) {
    int x = ans[i - 1];
    cout << x << " ";
  }
}
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int tt = 1; tt <= t; tt++) {
    solve();
  }
  return 0;
}
