func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> len(n);     vector<string> s(n);     for (int i = 0; i < n; i++) {       cin >> s[i];       len[i] = s[i].length();     }     const int all = n - 1 + accumulate(len.begin(), len.end(), 0);     vector<vector<bool>> eq(n, vector<bool>(n, false));     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (s[i] == s[j]) eq[i][j] = true;       }     }     vector<vector<int>> dp(n, vector<int>(n, 0));     for (int i = n - 1; i >= 0; i--) {       for (int j = n - 1; j >= 0; j--)         if (eq[i][j]) {           if (i + 1 < n and j + 1 < n)             dp[i][j] = dp[i + 1][j + 1] + 1;           else             dp[i][j] = 1;         }     }     int ans = all;     for (int i = 0; i < n; i++) {       int sum = 0;       for (int d = 0; i + d < n; d++) {         int cnt = 1;         sum += len[i + d];         for (int pos = i + d + 1; pos < n; pos++) {           if (dp[i][pos] > d) {             cnt++;             pos += d;           }         }         int res = all - sum * cnt + cnt;         if (cnt > 1 and ans > res) ans = res;       }     }     cout << ans << endl;     return 0;   }   