func_code_string: #include <bits/stdc++.h>   using namespace std;   void Print() { cout << endl; }   template <typename T1, typename... T>   void Print(const T1 &t1, const T &...t) {     cout << t1 <<    ;     Print(t...);   }   template <typename T1, typename T2>   ostream &operator<<(ostream &os, const pair<T1, T2> &p) {     os <<  (  << p.first <<  ,   << p.second <<  ) ;     return os;   }   long long gcd(long long a, long long b) {     if (b) {       long long r = a % b;       a = b, b = r;     }     return a;   }   tuple<long long, long long, long long> extend_gcd(long long a, long long b) {     if (b == 0)       return make_tuple(a, 1, 0);     else {       long long g, nx, ny;       std::tie(g, nx, ny) = extend_gcd(b, a % b);       return make_tuple(g, ny, nx - (a / b) * ny);     }   }   long long fastpow(long long a, long long e, long long mod) {     if (e == 0) return 1;     if (e == 1) return a % mod;     long long t = fastpow(a, e / 2, mod);     t = t * t % mod;     if (e & 1)       return t * a % mod;     else       return t % mod;   }   const double PI = 3.14159265358979323846;   const int MOD = (int)1e9 + 7;   char s[100007], t[100007];   int n, m;   long long dp[100007], psum[100007];   vector<int> process() {     vector<int> p(2);     int last = 0;     for (int i = 2; i <= m; i++) {       while (last > 0 && t[i] != t[last + 1]) last = p[last];       if (t[i] == t[last + 1])         p.push_back(++last);       else         p.push_back(last);     }     return p;   }   int main() {     scanf( %s %s , s + 1, t + 1);     n = strlen(s + 1);     m = strlen(t + 1);     auto pre = process();     unordered_set<int> pos;     int last = 0;     for (int i = 1; i <= n; i++) {       while (last > 0 && s[i] != t[last + 1]) last = pre[last];       if (s[i] == t[last + 1]) {         last++;         if (last == m) {           pos.insert(i);           last = pre[last];         }       }     }     long long ans = 0;     last = -1;     dp[0] = 1, psum[0] = 1;     for (int i = 1; i <= n; i++) {       if (!pos.count(i) && last == -1) {         dp[i] = 1;       } else if (pos.count(i)) {         dp[i] = (psum[i - m] + dp[i - 1]) % MOD;         last = i;       } else {         dp[i] = (psum[last - m] + dp[i - 1]) % MOD;       }       psum[i] = (dp[i] + psum[i - 1]) % MOD;     }     printf( %lld n , (dp[n] + MOD - 1) % MOD);   }   