#include <bits/stdc++.h>
using namespace std;
constexpr int inf32 = 0x3f3f3f3f;
constexpr long long inf64 = 0x3f3f3f3f3f3f3f3f;
constexpr int mod = 1000000007;
struct mint {
  int first;
  mint(int first = 0) : first(first) {}
  friend mint operator+(const mint a, const mint &b) {
    int first = a.first + b.first;
    return mint(first >= mod ? first - mod : first);
  }
  friend mint operator-(const mint a, const mint &b) {
    int first = a.first - b.first;
    return mint(first < 0 ? first + mod : first);
  }
  friend mint operator*(const mint a, const mint &b) {
    return mint(1ll * a.first * b.first % mod);
  }
};
int mypow(int a, int first = mod - 2, int res = 1) {
  for (; first; first >>= 1, a = (mint(a) * a).first)
    if (first & 1) res = (mint(res) * a).first;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  string s;
  cin >> n >> s;
  constexpr int B = 3917;
  vector<int> p(n + 1), pw(n + 1);
  pw[0] = 1;
  for (int i = 0; i < (n); ++i) pw[i + 1] = (mint(pw[i]) * B).first;
  for (int i = 0; i < (n); ++i) p[i + 1] = (mint(p[i]) * B + s[i]).first;
  auto sec = [&](int l, int r) {
    int res = (mint(p[r]) - mint(p[l]) * pw[r - l]).first;
    return res;
  };
  vector<int> res(n + 1 >> 1);
  if ((~n & 1) && (s[n - 1 >> 1] == s[n >> 1]))
    res[n - 1 >> 1] = 1;
  else
    res[n - 1 >> 1] = -1;
  for (int i = (n - 1 >> 1) - 1; i >= 0; --i) {
    res[i] = res[i + 1] + 2;
    for (; res[i] > -1; res[i] -= 2)
      if (sec(i, i + res[i]) == sec(n - i - res[i], n - i)) break;
  }
  for (int i = 0; i < (n + 1 >> 1); ++i) cout << res[i] << ' ';
  cout << '\n';
  return 0;
}
