#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  char s[n];
  scanf("%s", s);
  map<char, list<int> > index;
  for (int i = 0; i < n; i++) {
    index[s[i]].push_back(i);
  }
  int p[n];
  for (int i = 0; i < n; i++) p[i] = 1;
  int c = n;
  char t, d;
  int move;
  for (int i = 0; i < q; i++) {
    scanf(" %c %c", &t, &d);
    for (list<int>::iterator it = index[t].begin(); it != index[t].end();
         it++) {
      if (p[*it] != 0 && (q - i >= min(*it + 1, n - *it - 1))) {
        move = p[*it];
        p[*it] = 0;
        if (d == 'R') {
          if (*it == n - 1) {
            c -= move;
          } else {
            p[*it + 1] += move;
          }
        } else {
          if (*it == 0) {
            c -= move;
          } else {
            p[*it - 1] += move;
          }
        }
      }
    }
  }
  printf("%d\n", c);
  return 0;
}
