func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int read() {     char c = getchar();     int x = 0, f = 1;     for (; !isdigit(c); c = getchar())       if (c ==  - ) f = -1;     for (; isdigit(c); c = getchar()) x = x * 10 + c -  0 ;     return x * f;   }   const int MAXN = 8e3 + 5;   int nxt[MAXN], p[MAXN][MAXN], dp[MAXN];   int N, len;   char s[MAXN], S[MAXN];   inline int calc(int x) {     int ret = 0;     while (x) x /= 10, ret++;     return ret;   }   inline void KMP(int st) {     len = N - st + 1;     for (int i = 1; i <= len; i++) s[i] = S[st + i - 1];     int j = 0;     for (int i = 2; i <= len; i++) {       while (j && s[i] != s[j + 1]) j = nxt[j];       if (s[i] == s[j + 1]) j++;       nxt[i] = j;     }     for (int i = 1; i <= len; i++) {       int tmp = i - nxt[i];       if (i % tmp) tmp = i;       p[st][st + i - 1] = tmp + calc(i / tmp);     }   }   int main() {     scanf( %s , S + 1);     N = strlen(S + 1);     for (int i = 1; i <= N; i++) KMP(i);     memset(dp, 0x3f, sizeof(dp));     dp[0] = 0;     for (int i = 1; i <= N; i++)       for (int j = 0; j < i; j++) dp[i] = min(dp[i], dp[j] + p[j + 1][i]);     printf( %d n , dp[N]);     return 0;   }   