#include <bits/stdc++.h>
using namespace std;
int n;
char ch[2000200];
int has[2000200], pw[2000200];
unsigned long long _has[2000200], _pw[2000200];
int geth(int x, int y) {
  return (has[y] - 1ll * has[x - 1] * pw[y - x + 1] % 1000000007 + 1000000007) %
         1000000007;
}
unsigned long long _geth(int x, int y) {
  return _has[y] - _has[x - 1] * _pw[y - x + 1];
}
int st[2000200], top;
int main() {
  scanf("%d%s", &n, ch + 1);
  pw[0] = _pw[0] = 1;
  for (int i = 1; i <= n; i++)
    has[i] = (1ll * has[i - 1] * 173 % 1000000007 + ch[i]) % 1000000007,
    _has[i] = _has[i - 1] * 127 + ch[i],
    pw[i] = 1ll * pw[i - 1] * 173 % 1000000007, _pw[i] = _pw[i - 1] * 127;
  int l = (n - 1) / 2 + 1, r = n - l + 1;
  int lst = -1, ans = 0;
  while (r <= n) {
    int len = r - l + 1;
    if (len == 1)
      ans = -1;
    else {
      for (ans = lst + 2; ans > 0; ans -= 2)
        if (geth(l, l + ans - 1) == geth(r - ans + 1, r) &&
            _geth(l, l + ans - 1) == _geth(r - ans + 1, r))
          break;
    }
    st[++top] = ans, lst = ans, l--, r++;
  }
  for (int i = top; i; i--) printf("%d ", st[i]);
  puts("");
}
