#include <bits/stdc++.h>   using namespace std;   string s, s1, s2, s3;   int sa[300010][20], lcp[300010], rnk[300010], root[300010], cnt[300010][4],       col[300010], n;   pair<pair<int, int>, int> q[300010];   pair<int, pair<int, int> > lcp_pair[300010];   vector<long long> ansvec;   long long ans, mod = 1e9 + 7;   int get(int x) { return root[x] = (x == root[x] ? x : get(root[x])); }   void merge(int x, int y) {     root[y] = x;     ans -= (1LL * cnt[y][1] * cnt[y][2] * cnt[y][3]) % mod +            (1LL * cnt[x][1] * cnt[x][2] * cnt[x][3]) % mod;     while (ans < 0) ans += mod;     for (int i = 1; i <= 3; ++i) cnt[x][i] += cnt[y][i];     ans = (ans + 1LL * cnt[x][1] * cnt[x][2] * cnt[x][3]) % mod;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> s1 >> s2 >> s3;     n = min(s1.size(), min(s2.size(), s3.size()));     s = s1 +  1  + s2 +  2  + s3;     for (int i = 0; i < s1.size(); ++i) col[i] = 1;     for (int i = s1.size() + 1; i < s1.size() + 1 + s2.size(); ++i) col[i] = 2;     for (int i = s.size() - s3.size(); i < s.size(); ++i) col[i] = 3;     for (int i = 0; i < s.size(); ++i) sa[i][0] = s[i];     for (int i = 1; i < 20; ++i) {       for (int j = 0; j < s.size(); ++j)         if (j + (1 << i - 1) < s.size())           q[j] =               make_pair(make_pair(sa[j][i - 1], sa[j + (1 << i - 1)][i - 1]), j);         else           q[j] = make_pair(make_pair(sa[j][i - 1], -1), j);       sort(q, q + s.size());       int cnt = 0;       for (int j = 0; j < s.size(); ++j) {         if (j && q[j].first != q[j - 1].first) ++cnt;         sa[q[j].second][i] = cnt;       }     }     for (int i = 0; i < s.size(); ++i) {       rnk[sa[i][19]] = i;       root[i] = i;       cnt[i][col[i]] = 1;     }     int cnt = 0, index, ii = 0;     for (int i = 0; i < s.size(); ++i) {       index = sa[i][19];       if (index == s.size() - 1) {         cnt = 0;         continue;       }       while (i + cnt < s.size() && rnk[index + 1] + cnt < s.size() &&              s[i + cnt] == s[rnk[index + 1] + cnt])         ++cnt;       lcp[i] = cnt;       lcp_pair[ii] = make_pair(lcp[i], make_pair(i, rnk[index + 1]));       if (cnt) --cnt;       ++ii;     }     sort(lcp_pair, lcp_pair + s.size() - 1);     reverse(lcp_pair, lcp_pair + s.size() - 1);     for (int i = n, j = 0; i >= 1; --i) {       int x, y;       while (j < s.size() - 1 && lcp_pair[j].first >= i) {         x = get(lcp_pair[j].second.first);         y = get(lcp_pair[j].second.second);         merge(x, y);         ++j;       }       ansvec.push_back(ans);     }     for (int i = ansvec.size() - 1; i >= 0; --i) cout << ansvec[i] <<    ;   }   