func_code_string: #include <bits/stdc++.h>   using namespace std;   string a, b, c, s;   const long long mod = 1000000007;   long long res[310000], sum;   int N, ar[310000], srt[310000], dad[310000];   int where[310000], lcp[310000], F[310000], S[310000], T[310000];   pair<int, int> as[310000];   vector<pair<int, int> > q;   int comp(const int &a, const int &b) { return as[a] < as[b]; }   int find(int x) {     if (dad[x] == x) return x;     return dad[x] = find(dad[x]);   }   int main() {     cin >> a >> b >> c;     N = a.size() + b.size() + c.size() + 2;     s =     + a +  #  + b +  0  + c;     for (int i = 1; i <= N; i++) ar[i] = s[i];     for (int z = 0; (1 << z) <= N; z++) {       for (int i = 1; i <= N; i++)         as[i] = pair<int, int>(ar[i],                                ((i + (1 << z)) <= N) ? (ar[i + (1 << z)]) : (-1)),         srt[i] = i;       sort(srt + 1, srt + 1 + N, comp);       pair<int, int> prev = pair<int, int>(-1, -1);       for (int i = 1, cnt = 0; i <= N; i++) {         if (as[srt[i]] != prev) {           prev = as[srt[i]];           ++cnt;         }         ar[srt[i]] = cnt;       }     }     for (int i = 1; i <= N; i++) where[ar[i]] = i;     for (int i = 1, ss = 0; i <= N; i++) {       if (ar[i] == N) continue;       int x = where[ar[i] + 1];       while (s[i + ss] == s[x + ss] && i + ss <= N && x + ss <= N) ss++;       lcp[ar[i]] = ss;       q.push_back(pair<int, int>(ss, ar[i]));       if (ss) ss--;     }     for (int i = 1; i <= N; i++) {       dad[i] = i;       if (where[i] <= a.size())         F[i] = 1;       else if (where[i] <= a.size() + b.size() + 1)         S[i] = 1;       else         T[i] = 1;     }     sort(q.begin(), q.end());     reverse(q.begin(), q.end());     int M = min(a.size(), min(b.size(), c.size()));     for (int i = M, j = 0; i; i--) {       while (j < (int)q.size() && q[j].first >= i) {         int x = q[j].second, y = q[j].second + 1;         long long pl = -1LL * F[find(x)] * S[find(x)] * T[find(x)];         pl -= 1LL * F[find(y)] * S[find(y)] * T[find(y)];         F[find(x)] += F[find(y)];         S[find(x)] += S[find(y)];         T[find(x)] += T[find(y)];         dad[find(y)] = find(x);         pl += 1LL * F[find(x)] * S[find(x)] * T[find(x)];         sum = (sum + pl) % mod;         j++;       }       res[i] = sum;     }     for (int i = 1; i <= M; i++) printf( %d  , res[i]);     return 0;   }   