func_code_string: #include <bits/stdc++.h>   using namespace std;   string str[51], temp;   int main() {     int t, f, a;     int cnt = 0, ans = 0x3f3f3f3f;     scanf( %d , &t);     getchar();     for (int i = 0; i < t; i++) {       cin >> str[i];     }     for (int i = 0; i < t; i++) {       cnt = 0;       for (int j = 0; j < t; j++) {         temp = str[j] + str[j];         if (temp.find(str[i]) == string::npos) {           cout << -1 << endl;           return 0;         }         cnt += temp.find(str[i]);       }       ans = min(ans, cnt);     }     cout << ans << endl;     return 0;   }   