#include <bits/stdc++.h>
using namespace std;
void print_golem(vector<int>& golem) {
  for (int i = 0; i < golem.size(); i++) {
    printf("%d,", golem[i]);
  }
  printf("\n");
}
int main() {
  int N, Q;
  cin >> N >> Q;
  vector<int> golem(N, 1);
  map<char, vector<int> > field;
  for (int i = 0; i < N; i++) {
    char c;
    cin >> c;
    field[c].push_back(i);
  }
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    int div = d == 'R' ? 1 : -1;
    vector<int> f = field[t];
    int size = f.size();
    for (int j = 0; j < size; j++) {
      if (golem[f[j]] > 0) {
        if (f[j] + div >= 0 && f[j] + div < N) {
          golem[f[j] + div] += golem[f[j]];
        }
        golem[f[j]] = 0;
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += golem[i];
  }
  cout << sum << endl;
  return 0;
}
