func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MAXN = 500;   const long long INF = 1e9;   const long long BITS = 64;   const long double EPS = 1e-9;   void bye() {     cout <<   n ;     exit(0);   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int n;     cin >> n;     long long all = 0;     vector<string> g(n);     vector<int> pref(n);     for (int i = 0; i < n; i++) {       cin >> g[i];       all += (long long)(g[i]).size();       pref[i] = (i) ? pref[i - 1] + (long long)(g[i]).size() + 1                     : (long long)(g[i]).size();     }     all += n - 1;     vector<vector<bool> > eq(n, vector<bool>(n));     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         eq[i][j] = g[i] == g[j];       }     }     vector<vector<int> > dp(n, vector<int>(n));     for (int i = n - 1; i >= 0; i--) {       for (int j = n - 1; j >= 0; j--) {         if (eq[i][j]) {           if (i + 1 < n && j + 1 < n) {             dp[i][j] = dp[i + 1][j + 1] + 1;           } else {             dp[i][j] = 1;           }         }       }     }     long long ans = all;     for (int i = 0; i < n; i++) {       for (int k = 0; i + k < n; k++) {         long long now = (pref[i + k] - ((i) ? pref[i - 1] + 1 : 0));         long long cnt = 1;         for (int j = i + k + 1; j + k < n; j++) {           if (dp[i][j] > k) {             cnt++;             j += k;           }         }         if (cnt > 1) {           ans = min(ans, all + cnt * (k + 1) - now * cnt);         }       }     }     cout << ans;     bye();   }   