#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  int p[n];
  int c = n;
  p[0] = 0;
  for (int i = 1; i < n; i++) {
    p[i] = p[i - 1] + 1;
  }
  char t, d;
  for (int i = 0; i < q; i++) {
    cin >> t >> d;
    for (int j = 0; j < n; j++) {
      if (s[j] == t) {
        if (d == 'R') {
          p[i]++;
          if (p[i] > n - 1) c--;
        } else {
          p[i]--;
          if (p[i] < 0) c--;
        }
      }
    }
  }
  cout << c << endl;
  return 0;
}
