#include <bits/stdc++.h>
char str[1000001];
int res[1000001 / 2];
long long hash[1000001], hash_base[1000001];
const char inf = 'a';
const int base = 26;
const int prime = 1000000007;
long long get_hash(int begin, int end) {
  long long res =
      hash[end] - hash[begin - 1] * hash_base[end - begin + 1] % prime;
  return (res + prime) % prime;
}
int main() {
  int n, left, right;
  scanf("%d %s", &n, str);
  hash[0] = str[0] - inf, hash_base[0] = 1;
  left = (n - 1) >> 1, right = n >> 1;
  res[left] = ((~n & 1) && (str[left] == str[right])) ? 1 : -1;
  for (int i = 1; i < n; i += 1) {
    hash_base[i] = (hash_base[i - 1] * base) % prime;
    hash[i] = (hash[i - 1] * base + str[i] - inf) % prime;
  }
  for (left -= 1, right += 1; left >= 0; left -= 1, right += 1) {
    int temp = res[left + 1] + 2;
    while (temp > 0 &&
           get_hash(left, left + temp - 1) != get_hash(right - temp + 1, right))
      temp -= 2;
    res[left] = temp;
  }
  for (int i = 0; i < (n + 1) >> 1; i += 1) printf("%d ", res[i]);
  return 0;
}
