#include <bits/stdc++.h>
using namespace std;
struct Manacher {
  string s;
  vector<int> a;
  Manacher(string &s) : s(s) {}
  Manacher() {}
  void Init() {
    string st;
    st.push_back('^');
    for (char c : s) {
      st.push_back('*');
      st.push_back(c);
    }
    st.push_back('*');
    st.push_back('#');
    swap(s, st);
  }
  void Run() {
    Init();
    int n = s.size();
    a.resize(n);
    int C = 1, R = 1;
    for (int i = (2); i <= (n - 2); ++i) {
      int i_mirror = C * 2 - i;
      a[i] = ((i > R) ? 0 : (min(R - i, a[i_mirror])));
      while (s[i - 1 - a[i]] == s[i + 1 + a[i]]) ++a[i];
      if (i + a[i] > R) {
        C = i;
        R = i + a[i];
      }
    }
  }
  int Query(int id) { return a[id * 4 - 1] / 2; }
};
int res[2001000];
string st, s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n >> st;
  for (int i = 0; i < (n); ++i) {
    s.push_back(st[i]);
    s.push_back(st[n - i - 1]);
  }
  Manacher M(s);
  M.Run();
  for (int i = (1); i <= ((n + 1) / 2); ++i) res[i] = -1;
  for (int i = 0; i < ((n - 1) / 2 + (n % 2 == 0)); ++i) {
    int t = M.Query(i + 1);
    if (t % 2 == 0) t--;
    res[i - t / 2 + 1] = max(res[i - t / 2 + 1], t);
  }
  for (int i = (1); i <= ((n + 1) / 2); ++i) {
    res[i] = max(res[i], res[i - 1] - 2);
    cout << res[i] << ' ';
  }
}
