#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, r, q, p;
  char t, d;
  string s;
  cin >> n >> q;
  r = n;
  cin >> s;
  int num[n];
  vector<int> alp[26];
  for (i = 0; i < n; i++) {
    num[i] = 1;
    alp[s[i] - 'A'].push_back(i);
  }
  for (i = 0; i < q; i++) {
    cin >> t >> d;
    for (j = 0; j < alp[t - 'A'].size(); j++) {
      p = alp[t - 'A'][j];
      if (!(p == 0 && d == 'L') && !(p == n - 1 && d == 'R')) {
        if (d == 'R')
          num[p + 1] += num[p];
        else
          num[p - 1] += num[p];
      } else
        r -= num[p];
      num[p] = 0;
    }
  }
  cout << r << endl;
  return 0;
}
