#include <bits/stdc++.h>
using namespace std;
signed main() {
  signed N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  map<char, set<long long>> index;
  for (long long i = 0; i < N; i++) {
    index[s[i]].insert(i);
  }
  vector<long long> masu(N, 1);
  long long ans = 0;
  vector<char> t('0', Q);
  vector<char> d('0', Q);
  for (long long i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  for (long long i = 0; i < Q; i++) {
    for (long long j : index[t[i]]) {
      long long temp = masu[j];
      masu[j] = 0;
      if (d[i] == 'L') {
        if (j == 0) {
          ans = ans + temp;
        } else {
          masu[j - 1] = masu[j - 1] + temp;
        }
      } else {
        if (j == (N - 1)) {
          ans = ans + temp;
        } else {
          masu[j + 1] = masu[j + 1] + temp;
        }
      }
    }
  }
  cout << N - ans << endl;
  return 0;
}
