#include <bits/stdc++.h>
using namespace std;
char t[int(3e5)], d[int(3e5)];
string abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int mv[30][3];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  for (int q = 0; q < Q; q++) cin >> t[q] >> d[q];
  for (int q = 0; q < Q; q++) {
    for (int i = 0; i < 26; i++) {
      if (abc[i] == t[q]) {
        mv[i][2] += d[q] == 'L' ? -1 : 1;
        if (mv[i][0] < -mv[i][2]) mv[i][0] = -mv[i][2];
        if (mv[i][1] < mv[i][2]) mv[i][1] = mv[i][2];
        break;
      }
    }
  }
  int ans = N;
  for (int n = 0; n < N; n++) {
    for (int i = 0; i < 26; i++) {
      if (s[n] == abc[i]) {
        if (n - mv[i][0] < 0 || n + mv[i][1] >= N) {
          ans--;
          break;
        }
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
