func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     int k;     cin >> k;     int sz = s.size();     string land;     bool equal;     int begin, lenth, idx, res = 0, end;     for (int i = 0; i < sz; i++) {       begin = i;       land =   ;       for (int j = i; j < sz; j++) {         land += s[j];         end = min(j + 1 + j - begin + 1 - 1, sz - 1);         idx = 0;         equal = 1;         for (int l = j + 1; l <= end; l++, idx++) {           if (land[idx] != s[l]) {             equal = 0;             break;           }         }         lenth = end - (j + 1) + 1;         if (equal && lenth != j - begin + 1 && (j - begin + 1) - lenth <= k) {           if (j == sz - 1)             res = max(res, (((j - begin + 1) + lenth + k) / 2) * 2);           else             res = max(res, 2 * (j - begin + 1));         }         if (equal && lenth == j - begin + 1) res = max(res, 2 * (j - begin + 1));       }     }     cout << res;     return 0;   }   