#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i, j, k, N, Q;
  int deleted = 0;
  string s;
  char t, d;
  cin >> N >> Q;
  cin >> s;
  vector<int> data(N, 1);
  int table[27][200000] = {0};
  int tablecnt[27] = {0};
  for (i = 0; i < N; i++) {
    int tmp = s[i] - 'A';
    table[tmp][tablecnt[tmp]] = i;
    tablecnt[tmp]++;
  }
  for (i = 0; i < Q; i++) {
    cin >> t >> d;
    int tmp = t - 'A';
    for (j = 0; j < tablecnt[tmp]; j++) {
      k = table[tmp][j];
      if (k == 0 && d == 'L') {
        deleted += data[0];
        data[0] = 0;
      } else if (k == N - 1 && d == 'R') {
        deleted += data[N - 1];
        data[N - 1] = 0;
      } else {
        if (d == 'L') {
          data[k - 1] += data[k];
          data[k] = 0;
        } else {
          data[k + 1] += data[k];
          data[k] = 0;
        }
      }
    }
  }
  cout << N - deleted << endl;
  return 0;
}
