#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  map<char, vector<int> > inmap;
  string s;
  cin >> s;
  vector<int> pos(N, 1);
  for (char i = 'A'; i <= 'Z'; i++) {
    inmap[i] = vector<int>();
  }
  for (int i = 0; i < N; i++) {
    inmap[s[i]].push_back(i);
  }
  int ret = N;
  for (size_t i = 0; i < Q; i++) {
    char t, d;
    (void)getchar();
    scanf("%c %c", &t, &d);
    if (d == 'L') {
      for (auto it = inmap[t].begin(); it != inmap[t].end(); it = next(it)) {
        if ((*it) == 0)
          ret -= pos[*it];
        else
          pos[*it - 1] += pos[*it];
        pos[*it] = 0;
      }
    } else {
      for (auto it = inmap[t].begin(); it != inmap[t].end(); it = next(it)) {
        if (*it == N - 1)
          ret -= pos[*it];
        else
          pos[*it + 1] += pos[*it];
        pos[*it] = 0;
      }
    }
  }
  cout << ret << endl;
  return 0;
}
