#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i, j, k, N, Q, tmp, cnt;
  char t[200001], d[200001];
  int ltotal, rtotal, lnokori, rnokori;
  char s[200002];
  cin >> N >> Q;
  cin >> s;
  ltotal = rtotal = 0;
  for (i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
    if (d[i] == 'L') {
      ltotal++;
    }
  }
  rtotal = Q - ltotal;
  int *data = new int[N + 2];
  for (i = 1; i <= N; i++) {
    data[i] = 1;
  }
  data[0] = data[N + 1] = 0;
  vector<vector<int> > table;
  int tablecnt[27];
  for (i = 0; i < 27; i++) tablecnt[i] = 0;
  table.resize(27);
  for (i = 0; i < ltotal; i++) {
    tmp = s[i] - 'A';
    table[tmp].push_back(i);
    tablecnt[tmp]++;
  }
  for (i = max(N - rtotal, ltotal); i < N; i++) {
    tmp = s[i] - 'A';
    table[tmp].push_back(i);
    tablecnt[tmp]++;
  }
  lnokori = ltotal;
  rnokori = rtotal;
  for (i = 0; i < Q; i++) {
    tmp = t[i] - 'A';
    cnt = tablecnt[tmp];
    if (d[i] == 'L') {
      vector<int>::iterator lend =
          upper_bound(table[tmp].begin(), table[tmp].end(), lnokori - 1);
      for (vector<int>::iterator j = table[tmp].begin(); j != lend; j++) {
        k = (*j) + 1;
        data[k - 1] += data[k];
        data[k] = 0;
      }
      lnokori--;
      vector<int>::iterator rend =
          upper_bound(table[tmp].begin(), table[tmp].end(), N - rnokori - 1);
      if (rend != table[tmp].end()) {
        for (vector<int>::iterator j = table[tmp].end() - 1; j != rend; j--) {
          k = (*j) + 1;
          data[k - 1] += data[k];
          data[k] = 0;
        }
        k = (*rend) + 1;
        data[k - 1] += data[k];
        data[k] = 0;
      }
    } else {
      vector<int>::iterator rend =
          upper_bound(table[tmp].begin(), table[tmp].end(), N - rnokori - 1);
      if (rend != table[tmp].end()) {
        for (vector<int>::iterator j = table[tmp].end() - 1; j != rend; j--) {
          k = (*j) + 1;
          data[k + 1] += data[k];
          data[k] = 0;
        }
        k = (*rend) + 1;
        data[k + 1] += data[k];
        data[k] = 0;
      }
      rnokori--;
      vector<int>::iterator lend =
          upper_bound(table[tmp].begin(), table[tmp].end(), lnokori - 1);
      for (vector<int>::iterator j = table[tmp].begin(); j != lend; j++) {
        k = (*j) + 1;
        data[k + 1] += data[k];
        data[k] = 0;
      }
    }
  }
  cout << N - data[0] - data[N + 1] << endl;
  delete[] data;
  return 0;
}
