#include <bits/stdc++.h>
using namespace std;
const int N = 1000100, base = 13331, mod1 = 19270817, mod2 = 19491001;
int n;
char str[N];
long long h1[N], h2[N], p1[N], p2[N];
int res[N];
int get(long long h[], int l, int r, long long p[], const int mod) {
  return ((h[r] - h[l - 1] * p[r - l + 1]) % mod + mod) % mod;
}
int main() {
  cin >> n;
  scanf("%s", str + 1);
  p1[0] = p2[0] = 1;
  for (int i = 1; i <= n; i++) {
    p1[i] = (p1[i - 1] * base) % mod1;
    h1[i] = (h1[i - 1] * base + str[i]) % mod1;
    p2[i] = (p2[i - 1] * base) % mod2;
    h2[i] = (h2[i - 1] * base + str[i]) % mod2;
  }
  memset(res, -1, sizeof res);
  for (int i = (n + 1) / 2; i >= 1; i--) {
    if (i == (n + 1) / 2 && (n & 1)) continue;
    int now = res[i + 1] + 2;
    for (int j = now; j >= -1; j -= 2) {
      if (j == -1 ||
          get(h1, i, i + j - 1, p1, mod1) ==
              get(h1, n - i + 2 - j, n - i + 1, p1, mod1) ||
          get(h2, i, i + j - 1, p2, mod2) ==
              get(h2, n - i + 2 - j, n - i + 1, p2, mod2)) {
        res[i] = j;
        break;
      }
    }
  }
  for (int i = 1; i <= (n + 1) / 2; i++) printf("%d ", res[i]);
  puts("");
  return 0;
}
