#include <bits/stdc++.h>
using namespace std;
ostream cnull(NULL);
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cnull << sdbg << "=" << h << "\n";
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cnull << *sdbg++;
  cnull << "=" << h << ",";
  _dbg(sdbg + 1, a...);
}
const int MX = 1e6 + 7, BASE = 89, MOD = 1e9 + 696969;
long long hasz[MX];
long long PP[MX];
string s;
long long get(int l, int r) {
  long long odj = (hasz[l - 1] * PP[r - l + 1]) % MOD;
  return (MOD + hasz[r] - odj) % MOD;
}
int ans[MX];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  PP[0] = 1;
  int n;
  cin >> n >> s;
  for (int i = (1); i <= (n); ++i)
    PP[i] = (PP[i - 1] * BASE) % MOD,
    hasz[i] = (hasz[i - 1] * BASE + (s[i - 1] - 'a')) % MOD;
  int odp = -1;
  for (int i = (n + 1) / 2; i >= 1; --i) {
    ans[i] = -1;
    int dl = (n - 2 * (i - 1)) - 1;
    if (dl % 2 == 0) --dl;
    for (int j = min(dl, odp + 2); j >= 1; j -= 2) {
      if (get(i, i + j - 1) == get(n - i - j + 2, n - i + 1)) {
        ans[i] = j;
        break;
      }
    }
    odp = ans[i];
  }
  for (int i = (1); i <= ((n + 1) / 2); ++i) cout << ans[i] << ' ';
}
