#include <bits/stdc++.h>
const long long MOD = 1e9 + 9;
const long long BASE = 1009;
using namespace std;
long long norm(long long a) {
  while (a >= MOD) {
    a -= MOD;
  }
  while (a < 0) {
    a += MOD;
  }
  return a;
}
long long mul(long long a, long long b) {
  long long m = ((long double)(a)*b) / MOD;
  return norm(a * b - m * MOD);
}
void precalculation(string &input, vector<int> &hashing, vector<int> &ppow) {
  int N = hashing.size() - 1;
  for (int i = 0; i < N; i++) {
    hashing[i + 1] = norm(mul(hashing[i], BASE) + input[i] - 'a' + 1);
  }
  for (int i = 1; i < N; i++) {
    ppow[i] = mul(ppow[i - 1], BASE);
  }
}
long long getHash(vector<int> &hashing, vector<int> &ppow, int l, int r) {
  return norm(hashing[r] - mul(hashing[l], ppow[r - l]));
}
bool eq(string &input, vector<int> &hashing, vector<int> &ppow, int a, int b,
        int l) {
  if (a == b) return true;
  if (getHash(hashing, ppow, a, a + l) == getHash(hashing, ppow, b, b + l)) {
    return true;
  }
  return false;
}
int main() {
  int N;
  string input;
  vector<int> ppow;
  vector<int> hashing;
  cin >> N;
  cin >> input;
  ppow.assign(N + 1, 1);
  hashing.assign(N + 1, 0);
  precalculation(input, hashing, ppow);
  vector<int> length(N, 0);
  vector<int> maximum(N, 0);
  for (int i = 0; i < N / 2; i++) {
    int c1 = i, c2 = N - 1 - i;
    if (input[c1] != input[c2]) {
      length[i] = -1;
      continue;
    }
    int left = 0, right = c1 + 1;
    while (right > left + 1) {
      int mid = (left + right) / 2;
      if (eq(input, hashing, ppow, c1 - mid, c2 - mid, 2 * mid + 1)) {
        left = mid;
      } else {
        right = mid;
      }
    }
    length[i] = left;
  }
  for (int i = 0; i < N / 2; i++) {
    if (length[i] < 0) {
      continue;
    }
    maximum[i - length[i]] = max(maximum[i - length[i]], 2 * length[i] + 1);
  }
  for (int i = 1; i < N / 2; i++) {
    maximum[i] = max(maximum[i], maximum[i - 1] - 2);
  }
  for (int i = 0; i < (N + 1) / 2; i++) {
    if (i) cout << " ";
    if (maximum[i] == 0) maximum[i] = -1;
    cout << maximum[i];
  }
  cout << endl;
}
