#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1000000 + 5;
const long long mod = 1000000007;
struct SuffixArray {
  char s[maxn];
  long long minlen, n, c[maxn], rank[maxn], pri[maxn], sa[maxn];
  void build_sa(long long m) {
    n = strlen(s);
    s[n++] = 0;
    for (long long i = 0; i < m; i++) c[i] = 0;
    for (long long i = 0; i < n; i++) c[rank[i] = s[i]]++;
    for (long long i = 1; i < m; i++) c[i] += c[i - 1];
    for (long long i = n - 1; i >= 0; i--) sa[--c[rank[i]]] = i;
    for (long long k = 1; k <= n; k <<= 1) {
      long long p = 0;
      for (long long i = n - k; i < n; i++) pri[p++] = i;
      for (long long i = 0; i < n; i++)
        if (sa[i] >= k) pri[p++] = sa[i] - k;
      for (long long i = 0; i < m; i++) c[i] = 0;
      for (long long i = 0; i < n; i++) c[rank[pri[i]]]++;
      for (long long i = 1; i < m; i++) c[i] += c[i - 1];
      for (long long i = n - 1; i >= 0; i--) sa[--c[rank[pri[i]]]] = pri[i];
      swap(rank, pri);
      p = 0;
      rank[sa[0]] = p++;
      for (long long i = 1; i < n; i++)
        rank[sa[i]] = (pri[sa[i]] == pri[sa[i - 1]]) && (sa[i] + k < n) &&
                              (sa[i - 1] + k < n) &&
                              (pri[sa[i] + k] == pri[sa[i - 1] + k])
                          ? p - 1
                          : p++;
      if (p == n) break;
      m = p;
    }
  }
  long long H[maxn];
  void buildH() {
    for (long long i = 0; i < n; i++) rank[sa[i]] = i;
    for (long long i = 0, ans = 0; i < n; i++) {
      if (ans) ans--;
      if (rank[i] == 0) {
        H[rank[i]] = 0;
        continue;
      }
      long long j = sa[rank[i] - 1];
      while (s[i + ans] == s[j + ans]) ans++;
      H[rank[i]] = ans;
    }
  }
  long long l[3], ans[maxn], fa[maxn], cnt[maxn][3], vis[maxn];
  vector<long long> p[maxn], used;
  inline long long findset(long long x) {
    return fa[x] == x ? x : fa[x] = findset(fa[x]);
  }
  inline long long getX(long long x) {
    return x < l[1] ? 0 : (x < l[2] ? 1 : 2);
  }
  void solve() {
    long long now = 0;
    for (long long i = 0; i < n; i++) {
      fa[i] = i;
      p[H[i]].push_back(i);
    }
    for (long long L = n; L >= 1; L--) {
      for (long long j = 0; j < p[L].size(); j++) {
        long long P = p[L][j];
        vis[P] = 1;
        used.push_back(P);
        cnt[P][getX(sa[P])]++;
        if (P > 0 && vis[P - 1]) {
          long long front = findset(P - 1);
          cnt[front][getX(sa[front - 1])]++;
          (now -= (cnt[front][0] * cnt[front][1] * cnt[front][2]) % mod) %= mod;
          cnt[front][getX(sa[front - 1])]--;
          for (long long i = 0; i < 3; i++) (cnt[front][i] += cnt[P][i]) %= mod;
          cnt[front][getX(sa[front - 1])]++;
          (((now += (cnt[front][0] * cnt[front][1] * cnt[front][2]) % mod) %=
            mod) += mod) %= mod;
          cnt[front][getX(sa[front - 1])]--;
          fa[P] = front;
        }
        if (P < n - 1 && vis[P + 1]) {
          long long me = findset(P);
          cnt[P + 1][getX(sa[P])]++;
          cnt[me][getX(sa[me - 1])]++;
          (now -= ((cnt[P + 1][0] * cnt[P + 1][1] * cnt[P + 1][2]) % mod +
                   (cnt[me][0] * cnt[me][1] * cnt[me][2]) % mod) %
                  mod) %= mod;
          cnt[P + 1][getX(sa[P])]--;
          cnt[me][getX(sa[me - 1])]--;
          for (long long i = 0; i < 3; i++)
            (cnt[me][i] += cnt[P + 1][i]) %= mod;
          cnt[me][getX(sa[me - 1])]++;
          (((now += (cnt[me][0] * cnt[me][1] * cnt[me][2]) % mod) %= mod) +=
           mod) %= mod;
          cnt[me][getX(sa[me - 1])]--;
          fa[P + 1] = me;
        }
      }
      ans[L] = now;
    }
    for (long long i = 1; i <= minlen; i++)
      printf("%I64d%c", ans[i], i == minlen ? '\n' : ' ');
  }
} SA;
char tmp[maxn];
int main() {
  long long trash = 'W';
  SA.n = 0;
  scanf("%s", SA.s);
  SA.l[0] = SA.n;
  SA.n = strlen(SA.s);
  SA.minlen = SA.n;
  for (long long i = 1; i <= 2; i++) {
    SA.s[SA.n++] = trash++;
    SA.l[i] = SA.n;
    scanf("%s", tmp);
    long long n = strlen(tmp);
    SA.minlen = min(SA.minlen, n);
    for (long long j = 0; j < n; j++) SA.s[SA.n++] = tmp[j];
  }
  SA.build_sa('z' + 5);
  SA.buildH();
  SA.solve();
}
