func_code_string: #include <bits/stdc++.h>   using namespace std;   string start[1791791];   string fin[1791791];   pair<int, int> diffs[1791791];   int is_in(string a, string b) {     string s = a +  #  + b;     int n = (int)s.length();     vector<int> pi(n);     for (int i = 1; i < n; ++i) {       int j = pi[i - 1];       while (j > 0 && s[i] != s[j]) j = pi[j - 1];       if (s[i] == s[j]) ++j;       pi[i] = j;     }     for (int i = (int)a.length(); i < pi.size(); ++i) {       if (pi[i] == a.length()) {         return i - 2 * (int)a.length();       }     }     return -1;   }   int main() {     ios_base::sync_with_stdio(0);     int n;     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> start[i];     }     for (int i = 0; i < n; ++i) {       cin >> fin[i];     }     for (int i = 0; i < n; ++i) {       int first_diff = -1;       for (int ii = 0; ii < start[i].length(); ++ii) {         if (start[i][ii] != fin[i][ii]) {           first_diff = ii;           break;         }       }       int last_diff = -1;       for (int ii = 0; ii < start[i].length(); ++ii) {         if (start[i][ii] != fin[i][ii]) {           last_diff = ii;         }       }       diffs[i] = {first_diff, last_diff};     }     int one_with_diff = -1;     for (int i = 0; i < n; ++i) {       if (diffs[i].first != -1) {         one_with_diff = i;         break;       }     }     for (int i = 0; i < n; ++i) {       if (diffs[i].first != -1 && diffs[one_with_diff].first != -1 &&           i != one_with_diff) {         if (diffs[i].second - diffs[i].first !=             diffs[one_with_diff].second - diffs[one_with_diff].first) {           cout <<  NO ;           return 0;         }         for (int ii = 0; ii <= diffs[i].second - diffs[i].first; ++ii) {           if (start[i][diffs[i].first + ii] !=                   start[one_with_diff][diffs[one_with_diff].first + ii] ||               fin[i][diffs[i].first + ii] !=                   fin[one_with_diff][diffs[one_with_diff].first + ii]) {             cout <<  NO ;             return 0;           }         }       }     }     int same_pref_len = 0;     for (int pref_len = 1;; ++pref_len) {       char pref =  # ;       bool ok = 1;       for (int i = 0; i < n; ++i) {         if (diffs[i].first != -1) {           if (diffs[i].first < pref_len) {             ok = 0;             break;           }           if (pref ==  # ) {             pref = start[i][diffs[i].first - pref_len];           } else {             if (pref != start[i][diffs[i].first - pref_len]) {               ok = 0;               break;             }           }         }       }       if (!ok) {         break;       }       same_pref_len += 1;     }     int same_suff_len = 0;     for (int suff_len = 1;; ++suff_len) {       char suff =  # ;       bool ok = 1;       for (int i = 0; i < n; ++i) {         if (diffs[i].first != -1) {           if (diffs[i].second + suff_len >= start[i].length()) {             ok = 0;             break;           }           if (suff ==  # ) {             suff = start[i][diffs[i].second + suff_len];           } else {             if (suff != start[i][diffs[i].second + suff_len]) {               ok = 0;               break;             }           }         }       }       if (!ok) {         break;       }       same_suff_len += 1;     }     string from, to;     for (int i = 0; i < n; ++i) {       if (diffs[i].first != -1) {         from =   ;         for (int j = diffs[i].first - same_pref_len;              j <= diffs[i].second + same_suff_len; ++j) {           from += start[i][j];         }         to =   ;         for (int j = diffs[i].first - same_pref_len;              j <= diffs[i].second + same_suff_len; ++j) {           to += fin[i][j];         }         break;       }     }     for (int i = 0; i < n; ++i) {       if (diffs[i].first == -1) {         if (is_in(from, start[i]) != -1) {           cout <<  NO ;           return 0;         }       } else {         if (is_in(from, start[i]) != diffs[i].first - same_pref_len) {           cout <<  NO ;           return 0;         }       }     }     cout <<  YES  << endl;     cout << from << endl;     cout << to << endl;   }   