func_code_string: #include <bits/stdc++.h>   using namespace std;   int k, n;   bool contain_same;   string s[5005], t[5005];   bool check(int x, int y) {     swap(s[0][x], s[0][y]);     for (int i = 1; i < k; ++i) {       int dif = 0;       for (int j = 0; j < n; ++j) {         if (s[0][j] != s[i][j]) ++dif;       }       if (dif == 2 || (dif == 0 && contain_same)) continue;       swap(s[0][x], s[0][y]);       return 0;     }     return 1;   }   signed main() {     scanf( %d%d , &k, &n);     for (int i = 0; i < k; ++i) {       cin >> s[i];       t[i] = s[i];       sort(t[i].begin(), t[i].end());     }     for (int i = 1; i < k; ++i)       if (t[i] != t[i - 1]) return puts( -1 ), 0;     int alp[26] = {};     for (auto ch : s[0]) alp[ch -  a ]++;     for (int i = 0; i < 26; ++i)       if (alp[i] > 1) contain_same = 1;     int ma_val = 0, ma_id = 0;     for (int i = 1; i < k; ++i) {       int cnt = 0;       for (int j = 0; j < n; ++j) {         if (s[0][j] != s[i][j]) ++cnt;       }       if (cnt > 4)         return puts( -1 ), 0;       else if (ma_val < cnt) {         ma_val = cnt;         ma_id = i;       }     }     if (ma_val == 0) {       swap(s[0][0], s[0][1]);       cout << s[0];       return 0;     }     if (ma_val == 2) {       if (contain_same) {         cout << s[0];         return 0;       }       return puts( -1 ), 0;     }     vector<int> pos;     for (int i = 0; i < n; ++i)       if (s[0][i] != s[ma_id][i]) pos.push_back(i);     for (auto x : pos) {       for (int y = 0; y < n; ++y) {         if (x == y) continue;         if (check(x, y)) {           cout << s[0];           return 0;         }       }     }     puts( -1 );     return 0;   }   