func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 4e5 + 10;   int rd() {     int x = 0, w = 1;     char ch = 0;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) w = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + (ch ^ 48);       ch = getchar();     }     return x * w;   }   int to[N], nt[N], hd[N], tot = 1;   void adde(int x, int y) { ++tot, to[tot] = y, nt[tot] = hd[x], hd[x] = tot; }   char cc[N];   int n, ans, f[N], g[N], s[N * 50], ch[N * 50][2], rt[N], tz;   void inst(int o, int x) {     s[o] = x;     int l = 1, r = n;     while (l < r) {       int mid = (l + r) >> 1;       if (x <= mid)         o = ch[o][0] = ++tz, r = mid;       else         o = ch[o][1] = ++tz, l = mid + 1;       s[o] = x;     }   }   int merg(int o1, int o2) {     if (!o1 || !o2) return o1 + o2;     int o = ++tz;     s[o] = max(s[o1], s[o2]);     ch[o][0] = merg(ch[o1][0], ch[o2][0]);     ch[o][1] = merg(ch[o1][1], ch[o2][1]);     return o;   }   int quer(int o, int l, int r, int ll, int rr) {     if (!o || ll > rr) return s[0];     if (ll <= l && r <= rr) return s[o];     int an = s[0], mid = (l + r) >> 1;     if (ll <= mid) an = max(an, quer(ch[o][0], l, mid, ll, rr));     if (rr > mid) an = max(an, quer(ch[o][1], mid + 1, r, ll, rr));     return an;   }   int fa[N], tn[N][26], len[N], la = 1, tt = 1;   void extd(int xx, int i) {     int np = ++tt, p = la;     len[np] = len[p] + 1, inst(rt[np] = ++tz, i), la = np;     while (p && !tn[p][xx]) tn[p][xx] = np, p = fa[p];     if (!p)       fa[np] = 1;     else {       int q = tn[p][xx];       if (len[q] == len[p] + 1)         fa[np] = q;       else {         int nq = ++tt;         fa[nq] = fa[q], len[nq] = len[p] + 1,         memcpy(tn[nq], tn[q], sizeof(int) * 26);         fa[np] = fa[q] = nq;         while (p && tn[p][xx] == q) tn[p][xx] = nq, p = fa[p];       }     }   }   void dfs1(int x) {     for (int i = hd[x]; i; i = nt[i]) {       int y = to[i];       dfs1(y), rt[x] = merg(rt[x], rt[y]);     }   }   void dfs2(int x) {     if (x > 1) {       if (fa[x] == 1 ||           quer(rt[g[x]], 1, n, s[rt[x]] - len[x] + len[g[x]], s[rt[x]] - 1) > 0)         ++f[x], g[x] = x;     }     ans = max(ans, f[x]);     for (int i = hd[x]; i; i = nt[i]) {       int y = to[i];       f[y] = f[x], g[y] = g[x], dfs2(y);     }   }   int main() {     n = rd(), scanf( %s , cc + 1);     s[0] = -(1 << 25);     for (int i = 1; i <= n; ++i) extd(cc[i] -  a , i);     for (int i = 2; i <= tt; ++i) adde(fa[i], i);     dfs1(1);     dfs2(1);     printf( %d n , ans);     return 0;   }   