func_code_string: #include <bits/stdc++.h>   using namespace std;   long long p[2007], hs[2007];   string q, w;   vector<int> k, st, st1, st2;   long long hashing(long long z, long long x) {     return (hs[x + 1] - hs[z]) * p[q.size() - x + 1];   }   void kmp_process() {     int g, h;     g = 0, h = -1, k[0] = -1;     while (g < w.length()) {       while (h >= 0 && w[g] != w[h]) h = k[h];       g++, h++;       k[g] = h;     }   }   void kmp_matching() {     int g, h;     g = h = 0;     while (g < q.length()) {       while (h >= 0 && q[g] != w[h]) h = k[h];       g++, h++;       if (h == w.length()) st.push_back(g - h), h = k[h];     }   }   int main() {     int g, h, f;     string a, s, as;     vector<long long> sst;     cin >> q >> a >> s;     w = a;     k.assign(2003, 0);     kmp_process();     kmp_matching();     st1 = st;     st.clear(), k.clear();     w = s;     k.assign(2003, 0);     kmp_process();     kmp_matching();     st2 = st;     st.clear();     for (g = 0; g < st2.size(); g++) st2[g] += (s.length() - 1);     p[0] = 1;     for (g = 1; g <= 2003; g++) {       p[g] = (p[g - 1] * 31);     }     for (g = 1; g <= q.length(); g++) {       hs[g] = hs[g - 1] + q[g - 1] * p[g];     }     long long xx = max(a.length(), s.length());     for (g = 0; g < st1.size(); g++) {       h = lower_bound(st2.begin(), st2.end(), st1[g]) - st2.begin();       for (; h < st2.size(); h++)         if (st2[h] - st1[g] + 1 >= xx) {           long long m = hashing(st1[g], st2[h]);           sst.push_back(m);         }     }     sort(sst.begin(), sst.end());     sst.erase(unique(sst.begin(), sst.end()), sst.end());     printf( %d n , sst.size());     return 0;   }   