#include <bits/stdc++.h>
using namespace std;
long long n, h[1000010], x[1000010];
const long long mod = 1e9 + 7;
char s[1000010];
void init() {
  x[0] = 1;
  for (long long i = 1; i <= n; ++i) {
    x[i] = x[i - 1] * 27 % mod;
    h[i] = (h[i - 1] * 27 % mod + s[i] - 'a') % mod;
  }
}
long long get(long long l, long long r) {
  return (h[r] - h[l - 1] * x[r - l + 1] % mod + mod) % mod;
}
bool check(long long num, long long pos) {
  if (pos - num < 1 || (pos == (n + 1) / 2 && n % 2)) return 0;
  if (get(pos - num, pos + num) == get(n - pos + 1 - num, n - pos + 1 + num))
    return 1;
  return 0;
}
long long dp[1000010];
int main() {
  srand((unsigned)time(NULL));
  cin >> n >> s + 1;
  init();
  memset(dp, -1, sizeof dp);
  for (long long i = 1; i <= (n + 1) / 2; ++i) {
    long long l = 0, r = n, mid, ans = -1;
    while (l <= r) {
      mid = (l + r) >> 1;
      if (check(mid, i))
        ans = mid, l = mid + 1;
      else
        r = mid - 1;
    }
    dp[i - ans] = max(dp[i - ans], 2 * ans + 1);
  }
  for (long long i = 1; i <= (n + 1) / 2; ++i)
    dp[i] = max(dp[i], dp[i - 1] - 2);
  for (long long i = 1; i <= (n + 1) / 2; ++i) cout << dp[i] << " ";
  return 0;
}
