#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int i, j, k, N, Q;
  string s;
  char t, d;
  cin >> N >> Q;
  cin >> s;
  int *data = new int[N + 2];
  for (i = 1; i <= N; i++) {
    data[i] = 1;
  }
  data[0] = data[N + 1] = 0;
  int table[26][2000];
  int tablecnt[26];
  for (i = 0; i < 26; i++) {
    for (j = 0; j < 2000; j++) {
      table[i][j] = 0;
    }
    tablecnt[i] = 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] + 1;
      if (d == 'L') {
        data[k - 1] += data[k];
        data[k] = 0;
      } else {
        data[k + 1] += data[k];
        data[k] = 0;
      }
    }
  }
  cout << N - data[0] - data[N + 1] << endl;
  delete[] data;
  return 0;
}
