#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int>> poss(26);
  for (int i = 0; i < n; i++) {
    poss[s[i] - 'A'].push_back(i);
  }
  vector<int> objs(n, 1);
  int fall_count = 0;
  for (int i = 0; i < q; i++) {
    char c, d;
    cin >> c >> d;
    for (int p : poss[c - 'A']) {
      if ((p == 0 && d == 'L') || (p == n - 1 && d == 'R'))
        fall_count += objs[p];
      else {
        if (d == 'L') objs[p - 1] += objs[p];
        if (d == 'R') objs[p + 1] += objs[p];
      }
      objs[p] = 0;
    }
  }
  cout << (n - fall_count) << endl;
  return 0;
}
