#include <bits/stdc++.h>
using namespace std;
static const int ALPHA = 26;
int main() {
  int N, Q, gap = 0;
  cin >> N >> Q;
  vector<int> V[ALPHA];
  char s[N], t, d;
  int count[N];
  for (int i = 0; i < N; i++) count[i] = 1;
  scanf("%s", s);
  for (int i = 0; i < N; i++) {
    V[s[i] - 'A'].push_back(i);
  }
  for (int i = 0; i < Q; i++) {
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 0; j < V[t - 'A'].size(); j++) {
        if (V[t - 'A'][j] == 0) {
          gap += count[V[t - 'A'][j]];
          count[V[t - 'A'][j]] = 0;
        } else {
          count[V[t - 'A'][j] - 1] += count[V[t - 'A'][j]];
          count[V[t - 'A'][j]] = 0;
        }
      }
    } else {
      for (int j = V[t - 'A'].size() - 1; j >= 0; j--) {
        if (V[t - 'A'][j] == N - 1) {
          gap += count[N - 1];
          count[N - 1] = 0;
        } else {
          count[V[t - 'A'][j] + 1] += count[V[t - 'A'][j]];
          count[V[t - 'A'][j]] = 0;
        }
      }
    }
  }
  cout << N - gap << endl;
  return 0;
}
