func_code_string: #include <bits/stdc++.h>   using namespace std;   void computeLcp(string &s1, string &s2, int LCP[][5005]) {     for (int i = ((int)s1.size()) - 1; i >= 0; i--) {       for (int j = ((int)s2.size()) - 1; j >= 0; j--) {         if (s1[i] == s2[j]) {           LCP[i][j] = 1 + LCP[i + 1][j + 1];         } else {           LCP[i][j] = 0;         }       }     }   }   int lcp[5005][5005];   int mUA[5005];   int mUB[5005];   int main() {     ios_base::sync_with_stdio(0);     string A, B;     cin >> A >> B;     memset((lcp), (0), sizeof(lcp));     ;     computeLcp(A, A, lcp);     int ans = (1 << 30);     for (int i = 0; i < ((int)A.size()); i++) {       int minUniqueLength = 0;       for (int j = 0; j < ((int)A.size()); j++) {         if (i == j) continue;         minUniqueLength = max(minUniqueLength, lcp[i][j]);       }       minUniqueLength++;       mUA[i] = minUniqueLength;     }     memset((lcp), (0), sizeof(lcp));     ;     computeLcp(B, B, lcp);     for (int i = 0; i < ((int)B.size()); i++) {       int minUniqueLength = 0;       for (int j = 0; j < ((int)B.size()); j++) {         if (i == j) continue;         minUniqueLength = max(minUniqueLength, lcp[i][j]);       }       minUniqueLength++;       mUB[i] = minUniqueLength;     }     memset((lcp), (0), sizeof(lcp));     ;     computeLcp(A, B, lcp);     for (int i = 0; i < ((int)A.size()); i++) {       for (int j = 0; j < ((int)B.size()); j++) {         if (lcp[i][j] >= max(mUA[i], mUB[j])) {           ans = min(ans, max(mUA[i], mUB[j]));         }       }     }     if (ans >= (1 << 30)) ans = -1;     cout << ans << endl;     return 0;   }   