#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 50;
const int AC = 146527;
const long long mod = 1e9 + 7;
int n;
char s[maxn];
long long bas[maxn], sum[maxn];
int ans[maxn];
bool check(int x, int len) {
  long long hs1 = (sum[x + len - 1] - sum[x - 1] * bas[len] % mod + mod) % mod;
  long long hs2 =
      (sum[n - x + 1] - sum[n - x - len + 1] * bas[len] % mod + mod) % mod;
  if (hs1 == hs2)
    return true;
  else
    return false;
}
int solve(int x) {
  for (int len = n - 2 * (x - 1) - 1; len; len--) {
    if (len % 2 && check(x, len)) return len;
  }
  return -1;
}
int main() {
  scanf("%d%s", &n, s + 1);
  bas[0] = 1;
  for (int i = 1; i <= n; i++) {
    bas[i] = bas[i - 1] * AC % mod;
  }
  for (int i = 1; i <= n; i++) {
    sum[i] = (sum[i - 1] * AC + s[i] - 'a' + 1) % mod;
  }
  int mid = (n + 1) >> 1;
  for (int i = mid; i >= 1; i--) {
    if (i == mid) {
      ans[i] = solve(i);
    } else {
      ans[i] = ans[i + 1] + 2;
      while (ans[i] != -1 && check(i, ans[i]) == false) {
        ans[i] -= 2;
      }
    }
  }
  for (int i = 1; i <= mid; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
