func_code_string: #include <bits/stdc++.h>   using namespace std;   inline char gc() {     static char buf[100000], *p1 = buf, *p2 = buf;     return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)                ? EOF                : *p1++;   }   inline long long read() {     long long x = 0;     char ch = getchar();     bool positive = 1;     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) positive = 0;     for (; isdigit(ch); ch = getchar()) x = x * 10 + ch -  0 ;     return positive ? x : -x;   }   inline void write(long long a) {     if (a < 0) {       a = -a;       putchar( - );     }     if (a >= 10) write(a / 10);     putchar( 0  + a % 10);   }   inline void writeln(long long a) {     write(a);     puts(  );   }   inline void wri(long long a) {     write(a);     putchar(   );   }   inline unsigned long long rnd() {     return ((unsigned long long)rand() << 30 ^ rand()) << 4 | rand() % 4;   }   const int N = 50005, K = 16;   int n;   char ch[N], q[N];   struct data {     int m, tong[N], SA[N], y[N], x[N], rk[N], h[N], height[N], logn[N];     char ch[N];     int dp[N][K];     inline int ask(int a, int b) {       if (a == b) return n - a + 1;       a = rk[a];       b = rk[b];       if (a > b) swap(a, b);       b--;       int zs = logn[b - a + 1];       return min(dp[b][zs], dp[a + (1 << zs) - 1][zs]);     }     void init() {       int m = 150;       memset(SA, 0, sizeof(SA));       memset(rk, 0, sizeof(rk));       memset(h, 0, sizeof(h));       memset(height, 0, sizeof(height));       memset(dp, 0, sizeof(dp));       memset(tong, 0, sizeof(tong));       memset(x, 0, sizeof(x));       memset(y, 0, sizeof(y));       for (int i = 1; i <= n; i++) tong[x[i] = ch[i]]++;       for (int i = 1; i <= m; i++) tong[i] += tong[i - 1];       for (int i = n; i; i--) SA[tong[x[i]]--] = i;       logn[0] = -1;       for (int k = 1; k <= n; k <<= 1) {         int p = 0;         for (int i = n - k + 1; i <= n; i++) y[++p] = i;         for (int i = 1; i <= n; i++)           if (SA[i] > k) y[++p] = SA[i] - k;         memset(tong, 0, sizeof(tong));         for (int i = 1; i <= n; i++) tong[x[y[i]]]++;         for (int i = 1; i <= m; i++) tong[i] += tong[i - 1];         for (int i = n; i; i--) SA[tong[x[y[i]]]--] = y[i];         swap(x, y);         x[SA[1]] = p = 1;         for (int i = 2; i <= n; i++)           x[SA[i]] = y[SA[i]] == y[SA[i - 1]] && y[SA[i] + k] == y[SA[i - 1] + k]                          ? p                          : ++p;         if (p >= n) break;         m = p;       }       for (int i = 1; i <= n; i++) rk[SA[i]] = i;       for (int i = 1; i <= n; i++) {         int t = SA[rk[i] + 1];         for (h[i] = max(0, h[i - 1] - 1); ch[i + h[i]] == ch[t + h[i]]; h[i]++)           ;         height[rk[i]] = h[i];       }       for (int i = 1; i <= n; i <<= 1) logn[i] = logn[i >> 1] + 1;       for (int i = 1; i <= n; i++) {         dp[i][0] = height[i];         if (i > 1 && !logn[i]) logn[i] = logn[i - 1];       }       for (int j = 1; j < K; j++)         for (int i = 1 << j; i <= n; i++)           dp[i][j] = min(dp[i][j - 1], dp[i - (1 << (j - 1))][j - 1]);     }   } S1, S2;   bool check(int x) {     for (int i = x; i + x <= n; i += x) {       if (S1.ask(i, i + x) + S2.ask(n - i + 1, n - i - x + 1) >= x) return 1;     }     return 0;   }   void build() {     memset(S1.ch, 0, sizeof(S1.ch));     memset(S2.ch, 0, sizeof(S2.ch));     for (int i = 1; i <= n; i++) S1.ch[i] = S2.ch[n - i + 1] = ch[i];     S1.init();     S2.init();   }   int main() {     scanf( %s , ch + 1);     n = strlen(ch + 1);     build();     for (int i = 1; i <= n; i++)       if (check(i)) {         int tot = 0;         for (int j = 1; j <= i; j++) q[++tot] = ch[j];         for (int j = i + 1; j <= n; j++) {           q[++tot] = ch[j];           if (S1.ask(j - i, j) >= i) {             tot -= i;             for (int k = j + 1; k < j + i && k <= n; k++) q[++tot] = ch[k];             j = j + i - 1;             continue;           }         }         n = tot;         for (int j = 1; j <= n; j++) ch[j] = q[j];         build();       }     ch[n + 1] = 0;     puts(ch + 1);   }   