func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mn = 1010000, mm = 10100;   int n, m, i, j, k, t, a[mm], la[30], sa[30];   map<int, int> ans;   char s[mn], c[30];   bool cmp(int i, int j) { return la[i] > la[j]; }   int main() {     scanf( %s , s + 1);     n = strlen(s + 1);     scanf( %d , &m);     for (i = 1; i <= m; ++i) {       scanf( %s , c + 1);       k = strlen(c + 1);       t = 0;       for (j = 1; j <= k; ++j) t |= 1 << (c[j] - 97);       ans[t] = 0, a[i] = t;     }     for (i = 0; i <= 25; ++i) sa[i] = i;     for (i = 1; i <= n; ++i) {       if (s[i] == s[i + 1]) continue;       la[s[i] - 97] = i;       k = s[i + 1] - 97, t = 0;       sort(sa, sa + 26, cmp);       for (j = 0; j <= 25; ++j) {         if (!la[sa[j]] || sa[j] == k) break;         t |= 1 << sa[j];         if (t == 5) {           ++la[30];         }         if (ans.count(t)) ++ans[t];       }     }     for (i = 1; i <= m; ++i) printf( %d n , ans[a[i]]);     return 0;   }   