func_code_string: #include <bits/stdc++.h>   using namespace std;   char s[3010][3010], t[3010][3010], S[3010], T[3010];   int nxt[3010], len, pos, tl, tr, p[3010], pre[3010][3010], n, len_s[3010];   void change(int id) {     int n = strlen(s[id] + 1), j = 0;     for (int i = 1; i <= n; i++) {       while (j && S[j + 1] != s[id][i]) j = nxt[j];       if (S[j + 1] == s[id][i]) j++;       if (j == len) {         for (int k = 1; k <= len; k++) s[id][i - len + k] = T[k];         break;       }     }   }   void check(int id) {     int j = 0, diff = 0;     for (int i = 1; i <= len_s[id]; i++) {       while (j && S[j + 1] != s[id][i]) j = nxt[j];       if (S[j + 1] == s[id][i]) j++;       if (j == len && pre[id][i] - pre[id][i - len]) {         p[id] = i - len + 1;         break;       } else if (j == len)         j = nxt[j];     }   }   void get_S() {     int mx = 0;     for (int i = 1; i <= tl - 1; i++) {       int flag = 1;       for (int j = 1; j <= n; j++)         if (p[j] && (p[j] - i <= 0 || s[j][p[j] - i] != s[pos][tl - i])) {           flag = 0;           break;         }       if (flag)         mx++;       else         break;     }     tl -= mx;     mx = 0;     for (int i = 1; i <= n; i++)       if (p[i]) p[i] = p[i] + len - 1;     for (int i = 1; i <= len_s[pos] - tr; i++) {       int flag = 1;       for (int j = 1; j <= n; j++)         if (p[j] && (p[j] + i > len_s[j] || s[j][p[j] + i] != s[pos][tr + i])) {           flag = 0;           break;         }       if (flag)         mx++;       else         break;     }     tr += mx;     len = tr - tl + 1;     for (int i = 1; i <= len; i++) {       S[i] = s[pos][i + tl - 1];       T[i] = t[pos][i + tl - 1];     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %s , s[i] + 1);       len_s[i] = strlen(s[i] + 1);     }     for (int i = 1; i <= n; i++) scanf( %s , t[i] + 1);     for (int i = 1; i <= n; i++) {       int lef = len_s[i] + 1, righ = 0;       for (int j = 1; j <= len_s[i]; j++)         if (s[i][j] != t[i][j]) {           lef = min(lef, j);           righ = max(righ, j);           pre[i][j] = pre[i][j - 1] + 1;         } else           pre[i][j] = pre[i][j - 1];       if (righ - lef + 1 > len) {         len = righ - lef + 1;         for (int j = lef; j <= righ; j++) {           S[j - lef + 1] = s[i][j];           T[j - lef + 1] = t[i][j];         }         pos = i;         tl = lef;         tr = righ;       }     }     int j = 0;     for (int i = 2; i <= len; i++) {       while (j && S[j + 1] != S[i]) j = nxt[j];       if (S[j + 1] == S[i]) j++;       nxt[i] = j;     }     for (int i = 1; i <= n; i++) check(i);     get_S();     j = 0;     for (int i = 2; i <= len; i++) {       while (j && S[j + 1] != S[i]) j = nxt[j];       if (S[j + 1] == S[i]) j++;       nxt[i] = j;     }     for (int i = 1; i <= n; i++) {       change(i);       int len = strlen(s[i] + 1);       for (int j = 1; j <= len; j++)         if (s[i][j] != t[i][j]) {           puts( NO );           return 0;         }     }     puts( YES );     puts(S + 1);     puts(T + 1);     return 0;   }   