#include <bits/stdc++.h>
using namespace std;
const int hash_size = 2;
int p1[hash_size] = {1009, 1013};
int p2[hash_size] = {int(1e9) + 7, int(1e9) + 7};
int N;
char s[1000010];
int ans[1000010];
vector<int> hash_pre[1000010];
vector<int> hash_pow[1000010];
void prepare_hash() {
  for (int i = 0; i < hash_size; i++) {
    hash_pre[0].push_back(0);
    hash_pow[0].push_back(1);
  }
  for (int t = 1; t <= N; t++)
    for (int i = 0; i < hash_size; i++) {
      int temp;
      temp = ((long long)hash_pre[t - 1][i] * p1[i] + s[t - 1]) % p2[i];
      hash_pre[t].push_back(temp);
      temp = (long long)hash_pow[t - 1][i] * p1[i] % p2[i];
      hash_pow[t].push_back(temp);
    }
}
vector<int> get_hash(int l, int r) {
  vector<int> res;
  for (int i = 0; i < hash_size; i++) {
    int temp;
    temp = (hash_pre[r + 1][i] -
            (long long)hash_pre[l][i] * hash_pow[r - l + 1][i] % p2[i]);
    temp = (temp + p2[i]) % p2[i];
    res.push_back(temp);
  }
  return res;
}
bool check(int x, int l) {
  int y = N - x - 1;
  vector<int> hl = get_hash(x - l + 1, x + l - 1);
  vector<int> hr = get_hash(y - l + 1, y + l - 1);
  bool flag = true;
  for (int i = 0; i < hash_size; i++) flag &= (hl[i] == hr[i]);
  return flag;
}
int main() {
  scanf("%d", &N);
  scanf("%s", s);
  prepare_hash();
  for (int i = 0; i < (N + 1) / 2; i++) ans[i] = -1;
  for (int i = 0; i < N / 2; i++) {
    int l = 0, r = min(i + 1, N - i);
    while (l < r) {
      int mid = (l + r + 1) >> 1;
      if (check(i, mid))
        l = mid;
      else
        r = mid - 1;
    }
    ans[i - l + 1] = max(ans[i - l + 1], 2 * l - 1);
  }
  for (int i = 1; i < (N + 1) / 2; i++) ans[i] = max(ans[i], ans[i - 1] - 2);
  for (int i = 0; i < (N + 1) / 2; i++) {
    if (i) printf(" ");
    printf("%d", ans[i]);
  }
}
