func_code_string: #include <bits/stdc++.h>   using namespace std;   string str[100];   int func(string s1, string s2) {     int i, j, k;     int l1 = s1.length(), l2 = s2.length();     if (l1 != l2) return -1;     for (i = 0; i < l1; ++i) {       for (j = i, k = 0; k < l1; ++k, ++j) {         j = j % l1;         if (s1[k] != s2[j]) break;       }       if (k == l1) return i;     }     return -1;   }   int main() {     int i, j, k;     int n, cnt;     cin >> n;     for (i = 0; i < n; ++i) cin >> str[i];     int mn = 1000000000;     for (i = 0; i < n; ++i) {       cnt = 0;       for (j = 0; j < n; ++j) {         if (i == j) continue;         k = func(str[i], str[j]);         if (k == -1) {           printf( -1 n );           return 0;         }         cnt += k;       }       mn = min(mn, cnt);     }     cout << mn << endl;   }   