#include <bits/stdc++.h>   using namespace std;   char a[1000005];   char l[1000005];   char r[1000005];   int f[1000005];   int okl[1000005];   int okr[1000005];   int mod = 998244353;   char ss[2000005];   int heigh[2000005];   int sa[2000005];   int Rank[2000005];   int length;   int val[30];   int c[2000005];   int temp[2][2000005];   void suffix_array() {     int A = 250;     int* Rank = temp[0];     int* new_rank = temp[1];     for (int i = 0; i < A; ++i) c[i] = 0;     for (int i = 0; i < length; ++i) c[Rank[i] = ss[i]]++;     for (int i = 1; i < A; ++i) c[i] += c[i - 1];     for (int i = length - 1; i >= 0; --i) sa[--c[ss[i]]] = i;     for (int n = 1; n < length; n *= 2) {       for (int i = 0; i < A; ++i) c[i] = 0;       for (int i = 0; i < length; ++i) c[Rank[i]]++;       for (int i = 1; i < A; ++i) c[i] += c[i - 1];       int* sa2 = new_rank;       int r = 0;       for (int i = length - n; i < length; ++i) sa2[r++] = i;       for (int i = 0; i < length; ++i)         if (sa[i] >= n) sa2[r++] = sa[i] - n;       for (int i = length - 1; i >= 0; --i) sa[--c[Rank[sa2[i]]]] = sa2[i];       new_rank[sa[0]] = r = 0;       for (int i = 1; i < length; ++i) {         if (!(Rank[sa[i - 1]] == Rank[sa[i]] && sa[i - 1] + n < length &&               Rank[sa[i - 1] + n] == Rank[sa[i] + n]))           r++;         new_rank[sa[i]] = r;       }       swap(Rank, new_rank);       if (r == length - 1) break;       A = r + 1;     }   }   void lcp_array() {     for (int i = 0; i < length; ++i) Rank[sa[i]] = i;     for (int i = 0, lcp = 0, h = 0; i < length; i++)       if (Rank[i] == 0)         heigh[0] = 0;       else {         int j = sa[Rank[i] - 1];         if (lcp > 0) lcp--;         while (ss[i + lcp] == ss[j + lcp]) lcp++;         heigh[Rank[i]] = lcp;       }   }   int dp[1000005];   int okzero;   int main() {     scanf( %s , a);     scanf( %s , l);     if (l[0] ==  0  && l[1] == 0) l[0] =  1 , okzero = 1;     scanf( %s , r);     int lena = strlen(a), lenl = strlen(l), lenr = strlen(r);     for (int i = 0; a[i] != 0; i++) ss[i] = a[i];     ss[lena] =  $ ;     for (int i = 0; l[i] != 0; i++) ss[i + lena + 1] = l[i];     length = lena + lenl + 1;     ss[length] = 0;     suffix_array();     int st = 0;     for (int i = 0; i < length; i++) {       if (sa[i] == lena + 1) st = i;     }     lcp_array();     int now = 1e9;     for (int i = st + 1; i < length; i++) {       now = min(now, heigh[i]);       if (sa[i] < lena) {         if (a[sa[i] + now] < l[now]) {           okl[sa[i]] = 0;         } else {           okl[sa[i]] = 1;         }       }     }     now = 1e9;     for (int i = st - 1; i >= 0; i--) {       now = min(heigh[i + 1], now);       if (sa[i] < lena) {         if (a[sa[i] + now] < l[now]) {           okl[sa[i]] = 0;         } else {           okl[sa[i]] = 1;         }       }     }     for (int i = 0; r[i] != 0; i++) ss[i + lena + 1] = r[i];     length = lena + lenr + 1;     ss[length] = 0;     suffix_array();     st = 0;     for (int i = 0; i < length; i++) {       if (sa[i] == lena + 1) st = i;     }     lcp_array();     now = 1e9;     for (int i = st + 1; i < length; i++) {       now = min(now, heigh[i]);       if (sa[i] < lena) {         if (a[sa[i] + now] <= r[now] || r[now] == 0) {           okr[sa[i]] = 1;         } else {           okr[sa[i]] = 0;         }       }     }     now = 1e9;     for (int i = st - 1; i >= 0; i--) {       now = min(heigh[i + 1], now);       if (sa[i] < lena) {         if (a[sa[i] + now] <= r[now] || r[now] == 0) {           okr[sa[i]] = 1;         } else {           okr[sa[i]] = 0;         }       }     }     int l = 0, r = -1;     long long sum = 0;     if (lenl == 1) {       if (okl[r + 1]) {         if (a[r + 1] !=  0 ) sum += 1;         r++;       }     }     for (int i = 0; a[i] != 0; i++) {       dp[i] = sum;       if (a[i] ==  0  && okzero) {         if (i == 0)           dp[i]++;         else           dp[i] += dp[i - 1];         dp[i] %= mod;       }       while (1) {         if (i - r + 1 > lenl) {           if (a[r + 1] !=  0 ) {             if (r == -1)               sum++;             else               sum += dp[r];           }           r++;         } else if (i - r + 1 == lenl) {           if (okl[r + 1]) {             if (a[r + 1] !=  0 ) {               if (r == -1)                 sum++;               else                 sum += dp[r];             }             r++;           } else {             break;           }         } else {           break;         }       }       while (1) {         if (i - l + 2 > lenr) {           if (a[l] !=  0 ) {             if (l == 0)               sum--;             else               sum -= dp[l - 1];           }           l++;         } else if (i - l + 2 == lenr) {           if (!okr[l]) {             if (a[l] !=  0 ) {               if (l == 0)                 sum--;               else                 sum -= dp[l - 1];             }             l++;           } else {             break;           }         } else {           break;         }       }       sum = (sum % mod + mod) % mod;     }     printf( %d n , dp[lena - 1]);     return 0;   }