#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
const int h = 233333;
int len;
long long poww[maxn], ha[maxn];
char s[maxn];
int main() {
  scanf("%d%s", &len, s + 1);
  poww[0] = 1;
  for (int i = 1; i <= len; i++) {
    poww[i] = (h * poww[i - 1]) % mod;
  }
  for (int i = 1; i <= len; i++) {
    ha[i] = (ha[i - 1] * h + s[i]) % mod;
  }
  stack<int> ss;
  int temp;
  if (len & 1) {
    ss.push(-1);
    int mid = len / 2 + 1;
    for (int i = 1; i <= mid - 1; i += 1) {
      int j;
      for (j = ss.top() + 2; j != -1;) {
        int su = ((ha[mid + i] - ha[mid + i - j] * poww[j]) % mod + mod) % mod;
        int pr =
            ((ha[mid - i - 1 + j] - ha[mid - i - 1] * poww[j]) % mod + mod) %
            mod;
        if (su == pr) {
          ss.push(j);
          break;
        } else
          j -= 2;
      }
      if (j == -1) ss.push(j);
    }
  } else {
    int mid = len / 2;
    if (s[mid] == s[mid + 1])
      ss.push(1);
    else
      ss.push(-1);
    for (int i = 1; i <= mid - 1; i += 1) {
      int j;
      for (j = ss.top() + 2; j != -1;) {
        int su =
            ((ha[mid + i + 1] - ha[mid + i + 1 - j] * poww[j]) % mod + mod) %
            mod;
        int pr =
            ((ha[mid - i - 1 + j] - ha[mid - i - 1] * poww[j]) % mod + mod) %
            mod;
        if (su == pr) {
          ss.push(j);
          break;
        } else
          j -= 2;
      }
      if (j == -1) ss.push(j);
    }
  }
  while (ss.size()) {
    printf("%d ", ss.top());
    ss.pop();
  }
  return 0;
}
