#include <bits/stdc++.h>
using namespace std;
const int MAXN = 400100;
const long long mod = 1000000007;
const long long alpha = 300;
long long c[22][MAXN], p[MAXN], cn[MAXN], pn[MAXN], cnt[MAXN];
void suffix_ini(string s) {
  long long n = s.size();
  for (long long i = 0; i < n; i++) cnt[s[i]]++;
  for (long long i = 1; i < alpha; i++) cnt[i] += cnt[i - 1];
  for (long long i = n - 1; i >= 0; i--) p[--cnt[s[i]]] = i;
  long long cla = 0;
  c[0][p[0]] = 0;
  for (long long i = 1; i < n; i++) {
    if (s[p[i]] != s[p[i - 1]]) ++cla;
    c[0][p[i]] = cla;
  }
}
void suffix(string s) {
  long long n = s.size();
  for (long long h = 0; ((long long)1 << h) < n; h++) {
    for (long long i = 0; i < n; i++) {
      pn[i] = p[i] - ((long long)1 << h);
      if (pn[i] < 0) pn[i] += n;
    }
    memset(cnt, 0, sizeof cnt);
    for (long long i = 0; i < n; i++) cnt[c[h][pn[i]]]++;
    for (long long i = 1; i < n; i++) cnt[i] += cnt[i - 1];
    for (long long i = n - 1; i >= 0; i--) p[--cnt[c[h][pn[i]]]] = pn[i];
    long long cla = 0;
    cn[p[0]] = 0;
    for (long long i = 1; i < n; i++) {
      pair<long long, long long> cur = {c[h][p[i]],
                                        c[h][(p[i] + ((long long)1 << h)) % n]};
      pair<long long, long long> pre = {
          c[h][p[i - 1]], c[h][(p[i - 1] + ((long long)1 << h)) % n]};
      if (cur.first != pre.first || cur.second != pre.second) cla++;
      cn[p[i]] = cla;
    }
    for (long long i = 0; i < n; i++) c[h + 1][i] = cn[i];
  }
}
struct str {
  long long a = 0, b = 0, c = 0;
};
long long v[MAXN], n, k[MAXN], pai[MAXN];
str t[MAXN];
vector<long long> vec[MAXN];
long long res = 0;
long long A, B, C;
long long find(long long x) {
  if (pai[x] == x) return x;
  return pai[x] = find(pai[x]);
}
void join(long long a, long long b) {
  b = find(b);
  res -= t[b].a * t[b].b * t[b].c;
  long long h;
  if (a > b)
    h = a - 1;
  else
    h = a;
  if (p[h] < A)
    t[b].a--;
  else if (p[h] < A + B)
    t[b].b--;
  else
    t[b].c--;
  a = find(a);
  res -= t[a].a * t[a].b * t[a].c;
  t[b].a += t[a].a;
  t[b].b += t[a].b;
  t[b].c += t[a].c;
  res += t[b].a * t[b].b * t[b].c;
  res %= mod;
  pai[a] = b;
}
long long comp(long long x, long long y) {
  long long r = 0;
  for (long long i = 20; i >= 0; i--) {
    if (c[i][x] != c[i][y] || c[i][x] == -1) continue;
    r += ((long long)1 << i);
    x += ((long long)1 << i);
    y += ((long long)1 << i);
    if (x > n) x -= n;
    if (y > n) y -= n;
  }
  return r;
}
signed main() {
  memset(k, 0, sizeof k);
  memset(c, -1, sizeof c);
  string a, b, c;
  cin >> a >> b >> c;
  a += "#";
  b += "&";
  c += "$";
  A = a.size(), B = b.size(), C = c.size();
  string s = a + b + c;
  n = s.size();
  suffix_ini(s);
  suffix(s);
  for (long long i = 1; i < s.size(); i++) {
    v[i] = comp(p[i - 1], p[i]);
    pai[i] = i;
    if (p[i] < A)
      t[i].a++;
    else if (p[i] < A + B)
      t[i].b++;
    else
      t[i].c++;
    if (p[i - 1] < A)
      t[i].a++;
    else if (p[i - 1] < A + B)
      t[i].b++;
    else
      t[i].c++;
    vec[v[i]].push_back(i);
  }
  vector<long long> r;
  for (long long i = (long long)s.size(); i >= 1; i--) {
    for (auto j : vec[i]) {
      if (k[j + 1] == 1) join(j, j + 1);
      if (k[j - 1] == 1) join(j, j - 1);
      k[j] = 1;
    }
    if (i <= min({A, B, C}) - 1) r.push_back(res);
  }
  for (long long i = (long long)r.size() - 1; i >= 0; i--) cout << r[i] << " ";
}
