#include <bits/stdc++.h>
static void C_SnukeTheWizard();
int main() {
  C_SnukeTheWizard();
  return 0;
}
static void C_SnukeTheWizard() {
  int N = 0, Q = 0;
  char t = 0, d = 0, cr = 0;
  static int gorem[2 * (10 ^ 5)] = {0};
  static char s[2 * (10 ^ 5) + 1] = {0};
  scanf("%d %d", &N, &Q);
  scanf("%s", s);
  for (int i = 0; i < N; i++) {
    gorem[i] = 1;
  }
  for (int i = 0; i < Q; i++) {
    scanf(" %c %c", &t, &d);
    if (d == 'R') {
      if (s[N - 1] == t) {
        gorem[N - 1] = 0;
      }
      for (int p = N - 2; p >= 0; p--) {
        if (s[p] == t) {
          gorem[p + 1] += gorem[p];
          gorem[p] = 0;
        }
      }
    } else {
      if (s[0] == t) {
        gorem[0] = 0;
      }
      for (int p = 1; p < N; p++) {
        if (s[p] == t) {
          gorem[p - 1] += gorem[p];
          gorem[p] = 0;
        }
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += gorem[i];
  }
  printf("%d\n", sum);
  fflush(stdout);
  return;
}
