#include <bits/stdc++.h>   using namespace std;   const int N = 1e6 + 5, maxh = 3;   int mod[maxh] = {(int)1e9 + 7, (int)1e9 + 9, (int)998244353};   struct data {     int v[maxh];     data(int a = 0, int b = 0, int c = 0) {       v[0] = a;       v[1] = b;       v[2] = c;     }     int& operator[](int w) { return v[w]; }     friend data operator+(data a, data b) {       for (int i = 0; i < maxh; ++i) a[i] = (a[i] + b[i]) % mod[i];       return a;     }     friend data operator+(data a, int b) {       for (int i = 0; i < maxh; ++i) a[i] = (a[i] + b) % mod[i];       return a;     }     friend data operator*(data a, data b) {       for (int i = 0; i < maxh; ++i) a[i] = 1ll * a[i] * b[i] % mod[i];       return a;     }     friend data operator*(data a, int b) {       for (int i = 0; i < maxh; ++i) a[i] = 1ll * a[i] * b % mod[i];       return a;     }     friend bool operator==(data a, data b) {       for (int i = 0; i < maxh; ++i)         if (a[i] != b[i]) return false;       return true;     }     friend data operator-(data a, data b) {       for (int i = 0; i < maxh; ++i)         a[i] = ((a[i] - b[i]) % mod[i] + mod[i]) % mod[i];       return a;     }     void print() { cout << v[0] <<     << v[1] <<     << v[2] <<   n ; }   };   data H[N], Pow[N];   int n;   char s[N];   data geth(int L, int R) { return H[R] - H[L - 1] * Pow[R - L + 1]; }   vector<int> Ans;   int main() {     scanf( %d%s , &n, s + 1);     Pow[0] = data(1, 1, 1);     for (int i = 1; i <= n; ++i) Pow[i] = Pow[i - 1] * 1331;     for (int i = 1; i <= n; ++i) H[i] = (H[i - 1] * 1331) + (int)s[i];     for (int i = (n + 1) / 2, lst = 10000000, cur; i >= 1; --i) {       int st = i, ed = n + 1 - st, mx = min(lst + 2, ed - st);       mx -= (mx % 2 == 0);       cur = -1;       for (int t = mx; t >= 1; t -= 2)         if (geth(st, st + t - 1) == geth(ed - t + 1, ed)) {           cur = t;           break;         }       Ans.push_back(cur);       lst = cur;     }     reverse(Ans.begin(), Ans.end());     for (auto x : Ans) cout << x <<    ;     return 0;   }   