func_code_string: #include <bits/stdc++.h>   using namespace std;   const int M = 200005;   const int N = 900005;   struct node {     int son[27];     int fa;   } a[N];   int sz;   char s[N];   int mat[M];   vector<int> over[N];   inline int new_id() {     ++sz;     over[sz].clear();     for (int i = (1); i <= (26); i++) a[sz].son[i] = -1;     return sz;   }   int np, ans;   void ins(int pos, int x, int y) {     over[pos].push_back(np);     if (x == y) return;     int cur = s[x] -  a  + 1;     if (a[pos].son[cur] == -1) {       a[pos].son[cur] = new_id();       a[a[pos].son[cur]].fa = pos;     }     ins(a[pos].son[cur], ++x, y);     return;   }   int u[M], n;   void dfs(int x, int dep) {     for (int i = (1); i <= (26); i++)       if (a[x].son[i] != -1) dfs(a[x].son[i], dep + 1);     vector<int> g1, g2;     g1.clear();     g2.clear();     for (int i = 0; i < over[x].size(); i++) {       int j = over[x][i];       if (u[j]) continue;       if (j <= n)         g1.push_back(j);       else         g2.push_back(j);     }     for (int i = 0; i < min(g1.size(), g2.size()); i++) {       ans += dep;       u[g1[i]] = u[g2[i]] = 1;       mat[g1[i]] = g2[i] - n;     }   }   int main() {     scanf( %d , &n);     sz = -1;     new_id();     for (int i = (1); i <= (n * 2); i++) {       np = i;       scanf( %s , &s);       int len = strlen(s);       ins(0, 0, len);     }     dfs(0, 0);     printf( %d n , ans);     for (int i = (1); i <= (n); i++) printf( %d %d n , i, mat[i]);     return 0;   }   