func_code_string: #include <bits/stdc++.h>   using namespace std;   int dx[4] = {1, -1, 0, 0};   int dy[4] = {0, 0, 1, -1};   void fast() {     ios_base::sync_with_stdio(NULL);     cin.tie(0);     cout.tie(0);   }   void online_judge() {     freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   const int flag_max = 0x3f3f3f3f;   const long long OO = 2e9 + 10;   const double EPS = (1e-8);   int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }   long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }   long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }   const long long MOD = 1e14 + 7;   long long Power(long long n, long long deg) {     if (!deg)       return 1;     else if (deg & 1)       return (Power(n, deg - 1) * n);     else {       long long half = Power(n, deg / 2);       return ((half * half));     }   }   int k, ans = 0;   string s;   vector<pair<char, char> > pr;   int main() {     fast();     cin >> s;     cin >> k;     for (int i = 0; i < k; i++) {       string q;       cin >> q;       int F = 0, S = 0;       for (int i = 0; i < s.size(); i++) {         if (s[i] == q[0] || s[i] == q[1])           if (s[i] == q[0])             F++;           else             S++;         else           ans += min(F, S), S = F = 0;       }       ans += min(F, S);     }     cout << ans;     return 0;   }   