func_code_string: #include <bits/stdc++.h>   using namespace std;   void __print(int x) { cout << x; }   void __print(long x) { cout << x; }   void __print(long long x) { cout << x; }   void __print(unsigned x) { cout << x; }   void __print(unsigned long x) { cout << x; }   void __print(unsigned long long x) { cout << x; }   void __print(float x) { cout << x; }   void __print(double x) { cout << x; }   void __print(long double x) { cout << x; }   void __print(char x) { cout <<      << x <<     ; }   void __print(const char *x) { cout <<     << x <<    ; }   void __print(const string &x) { cout <<     << x <<    ; }   void __print(bool x) { cout << (x ?  true  :  false ); }   template <typename T, typename V>   void __print(const pair<T, V> &x) {     __print(x.first);     cout <<  , ;     __print(x.second);   }   template <typename T>   void __print(const T &x) {     int f = 0;     for (auto &i : x) cout << (f++ ?  ,  :   ), __print(i);   }   void _print() { cout <<  ] n ; }   template <typename T, typename... V>   void _print(T t, V... v) {     __print(t);     if (sizeof...(v)) cout <<  ,  ;     _print(v...);   }   const int N = 2e5 + 7;   const int MOD = 1e9 + 7;   long long fastpow(long long b, long long p) {     long long temp;     if (p == 0) return 1;     if (p == 1) return b;     temp = fastpow(b, p / 2);     temp = temp * temp % MOD;     if (p & 1) {       temp = temp * b % MOD;     }     return temp;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     long long n, k;     cin >> n >> k;     string s;     cin >> s;     vector<char> v(k);     for (int i = 0; i < k; i++) cin >> v[i];     vector<int> temp(n);     for (int i = 0; i < n; i++) {       if (count(v.begin(), v.end(), s[i]))         temp[i] = 1;       else         temp[i] = 0;     }     long long ans = 0;     for (int i = 0; i < n; i++) {       if (temp[i] == 1) {         long long j = i;         while (j < n && temp[j] == 1) j++;         ans += ((j - i) * (j - i + 1)) / 2;         i = j;       }     }     cout << ans;     return 0;   }   