func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   char s[10000010];   struct Trie {     struct nd {       int ch[2], fa, fail, pos;     } t[10000010];     int used;     Trie() : used(1) {}     int id[10000010];     int ins(int len, int I) {       int u = 1;       for (int i = 1; i <= len; i++) {         if (!t[u].ch[s[i] -  a ])           t[u].ch[s[i] -  a ] = ++used, t[t[u].ch[s[i] -  a ]].fa = u;         u = t[u].ch[s[i] -  a ];       }       id[u] = I;       return u;     }     void build() {       queue<int> q;       for (int j = 0; j < 2; j++)         if (t[1].ch[j]) {           t[t[1].ch[j]].fail = 1;           q.push(t[1].ch[j]);         }       while (!q.empty()) {         int i = q.front();         q.pop();         if (id[i])           t[i].pos = id[i];         else           t[i].pos = t[t[i].fail].pos;         for (int j = 0; j < 2; j++) {           if (t[i].ch[j])             t[t[i].ch[j]].fail = t[t[i].fail].ch[j], q.push(t[i].ch[j]);           else             t[i].ch[j] = t[t[i].fail].ch[j];         }       }     }   } T;   int r[1000];   bool e[1000][1000];   void add(int i) {     int p = r[i];     if (T.t[T.t[p].fail].pos) {       e[T.t[T.t[p].fail].pos][i] = 1;     }     p = T.t[p].fa;     while (p) {       if (T.t[p].pos) {         e[T.t[p].pos][i] = 1;       }       p = T.t[p].fa;     }   }   int cp[1000];   bool vis[1000];   vector<int> pth[1000];   int fnd(int x) {     for (int i = 1; i <= n; i++) {       if (!vis[i] && e[x][i]) {         vis[i] = 1;         if (!cp[i] || fnd(cp[i])) {           cp[i] = x;           return 1;         }       }     }     return 0;   }   int id[1000];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %s , s + 1);       int m = strlen(s + 1);       r[i] = T.ins(m, i);     }     T.build();     for (int i = 1; i <= n; i++) add(i);     for (int k = 1; k <= n; k++) {       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= n; j++) e[i][j] |= (e[i][k] & e[k][j]);       }     }     for (int i = 1; i <= n; i++) {       memset(vis, 0, sizeof(vis));       fnd(i);     }     memset(vis, 0, sizeof(vis));     for (int i = 1; i <= n; i++)       if (cp[i]) vis[cp[i]] = 1;     int c = 0;     for (int i = 1; i <= n; i++) {       if (!vis[i]) {         c++;         int x = i;         pth[c].push_back(x);         while (cp[x]) {           x = cp[x];           pth[c].push_back(x);         }         reverse(pth[c].begin(), pth[c].end());       }     }     for (int i = 1; i <= c; i++) id[i] = pth[i].size() - 1;     while (1) {       memset(vis, 0, sizeof(vis));       for (int i = 1; i <= c; i++) {         int u = pth[i][id[i]];         for (int j = 1; j <= n; j++)           if (e[u][j]) vis[j] = 1;       }       bool fl = 1;       for (int i = 1; i <= c; i++)         if (vis[pth[i][id[i]]]) {           fl = 0;           break;         }       if (fl) break;       for (int i = 1; i <= c; i++) {         while (vis[pth[i][id[i]]]) id[i]--;       }     }     printf( %d n , c);     for (int i = 1; i <= c; i++) printf( %d  , pth[i][id[i]]);   }   