#include <bits/stdc++.h>
int main() {
  int N, Q;
  scanf("%d %d\n", &N, &Q);
  char t[Q], d[Q];
  char s[N];
  scanf("%s\n", s);
  unsigned int lostcounter = 0;
  unsigned int golem[N];
  for (int g = 0; g < N; g++) {
    golem[g] = 1;
  }
  for (int i = 0; i < Q; i++) {
    scanf("%c %c\n", &t[i], &d[i]);
    if (d[i] == 'R') {
      for (int l = 0; l < N; l++) {
        if (s[l] == t[i]) {
          if (l == N - 1)
            lostcounter += golem[l];
          else
            golem[l + 1] += golem[l];
          golem[l] = 0;
        }
      }
    } else if (d[i] == 'L') {
      for (int l = 0; l < N; l++) {
        if (s[l] == t[i]) {
          if (l == 0)
            lostcounter += golem[l];
          else
            golem[l - 1] += golem[l];
          golem[l] = 0;
        }
      }
    }
  }
  printf("%d\n", N - lostcounter);
  return 0;
}
