#include <bits/stdc++.h>
using namespace std;
int n, l, r;
int ans[1000000 + 5];
long long mmod = 2333, mod = 1e9 + 7;
long long shash[1000000 + 5], base[1000000 + 5];
char s[1000000 + 5];
int main() {
  scanf("%d%s", &n, s + 1);
  base[0] = 1;
  for (int i = 1; i <= n; i++) {
    shash[i] = (shash[i - 1] * mmod + s[i] - 'a' + 1) % mod;
    base[i] = base[i - 1] * mmod % mod;
  }
  if (n % 2 == 1) {
    ans[(n + 1) / 2] = -1;
    l = r = (n + 1) / 2;
  } else {
    l = n / 2;
    r = n / 2 + 1;
    if (s[l] == s[r])
      ans[n / 2] = 1;
    else
      ans[n / 2] = -1;
  }
  for (int i = (n + 1) / 2 - 1; i >= 1; i--) {
    l--;
    r++;
    for (int j = ans[i + 1] + 2; j >= 1; j -= 2) {
      long long a =
          (shash[l + j - 1] - shash[l - 1] * base[j] % mod + mod) % mod;
      long long b = (shash[r] - shash[r - j] * base[j] % mod + mod) % mod;
      if (a == b) {
        ans[i] = j;
        break;
      }
    }
    if (ans[i] == 0) ans[i] = -1;
  }
  for (int i = 1; i < (n + 1) / 2; i++) printf("%d ", ans[i]);
  printf("%d", ans[(n + 1) / 2]);
  return 0;
}
