#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int Q;
  string s;
  cin >> N >> Q >> s;
  vector<int> t(Q - 1, 0);
  vector<int> d(Q - 1, 0);
  char tstr;
  char dstr;
  for (int q = 0; q < Q; q++) {
    cin >> tstr;
    cin >> dstr;
    t[q] = (int)tstr - 48;
    if (dstr == 'R') {
      d[q] = 1;
    }
  }
  int mass[N - 1][2];
  for (int n = 0; n < N; n++) {
    mass[n][0] = (int)s[n] - 48;
    mass[n][1] = 1;
  }
  for (int q = 0; q < Q; q++) {
    for (int n = 0; n < N; n++) {
      if (t[q] == mass[n][0]) {
        if (d[q] == 0) {
          if (n == 0) {
            mass[n][1] = 0;
          } else {
            mass[n][1]--;
            mass[n - 1][1]++;
          }
        }
        if (d[q] == 1) {
          if (n == N - 1) {
            mass[n - 1][1] = 0;
          } else {
            mass[n][1]--;
            mass[n + 1][1]++;
          }
        }
      }
    }
  }
  int total = 0;
  for (int n = 0; n < N; n++) {
    total = total + mass[n][1];
  }
  cout << total << endl;
}
