func_code_string: #include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   template <class T>   T SQR(const T &a) {     return a * a;   }   void run() {     char str[1000100];     scanf( %s , str);     int n = strlen(str);     int m;     cin >> m;     int A[10001];     int B[10001];     map<int, int> res;     char pat[100];     for (int i = (0), ei = (m); i < ei; i++) {       scanf(  %s , pat);       int mask = 0;       for (int j = (0), ej = (strlen(pat)); j < ej; j++)         mask |= 1 << (pat[j] -  a );       B[i] = A[i] = mask;     }     sort(B, B + m);     int Pos[26] = {0};     for (int i = (0), ei = (26); i < ei; i++) Pos[i] = -1;     int mask = 0, curr;     pair<int, int> P[26];     str[n] =  z  + 1;     for (int i = (0), ei = (n); i < ei; i++) {       mask |= 1 << (str[i] -  a );       Pos[str[i] -  a ] = i;       for (int j = (0), ej = (26); j < ej; j++) {         P[j].first = Pos[j];         P[j].second = j;       }       sort(P, P + 26);       curr = mask;       int next = 1 << (str[i + 1] -  a );       if (binary_search(B, B + m, mask) && (mask & next) == 0) res[mask]++;       for (int j = (0), ej = (25); j < ej; j++)         if (P[j].first != -1) {           curr &= ~(1 << P[j].second);           if (binary_search(B, B + m, curr) && (curr & next) == 0) res[curr]++;         }     }     for (int i = (0), ei = (m); i < ei; i++) printf( %d n , res[A[i]]);   }   int main() {     run();     return 0;   }   