#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  char td[q][2];
  int alp[200][3];
  for (int i = 0; i < 200; i++) {
    for (int j = 0; j < 3; j++) alp[i][j] = 0;
  }
  for (int i = 0; i < q; i++) {
    cin >> td[i][0] >> td[i][1];
    if (td[i][1] == 'L')
      alp[(int)td[i][0]][2]--,
          alp[(int)td[i][0]][0] =
              min(alp[(int)td[i][0]][2], alp[(int)td[i][0]][0]);
    else
      alp[(int)td[i][0]][2]++,
          alp[(int)td[i][0]][1] =
              max(alp[(int)td[i][0]][1], alp[(int)td[i][0]][2]);
  }
  int ans = 0;
  for (int i = 0; i < (int)s.size(); i++) {
    if (alp[(int)s[i]][0] >= 0 && alp[(int)s[i]][1] < n) ans++;
  }
  cout << ans << endl;
  return 0;
}
