#include <bits/stdc++.h>
int main() {
  int n, q;
  scanf("%d", &n);
  scanf("%d", &q);
  char s[200001];
  scanf("%s", s);
  char t[200001];
  char d[200001];
  int gn = n;
  int g[200001] = {0};
  for (int i = 0; i < q; i++) {
    scanf("%s", &t[i]);
    scanf("%s", &d[i]);
    g[i] = 1;
  }
  if (0) {
    printf("n = %d\nq = %d\n", n, q);
    printf("s: %s\n", s);
    for (int i = 0; i < q; i++) {
      printf("i=%2d: %c %c\n", i, t[i], d[i]);
    }
  }
  if (0) {
    for (int k = 0; k < n; k++) {
      printf("%c ", s[k]);
    }
    printf("\n");
    for (int k = 0; k < n; k++) {
      printf("%d ", g[k]);
    }
    printf(":gn=%2d", gn);
    printf("\n");
  }
  for (int i = 0; i < q; i++) {
    char letter = t[i];
    int goleft;
    if (d[i] == 'L')
      goleft = 1;
    else if (d[i] == 'R')
      goleft = 0;
    if (0) printf("[%c, %c]\n", t[i], d[i]);
    if (goleft) {
      for (int j = 0; j < n; j++) {
        if (s[j] != letter) continue;
        if (j == 0) {
          gn -= g[j];
          g[j] = 0;
        } else {
          g[j - 1] += g[j];
          g[j] = 0;
        }
      }
    } else {
      for (int j = n - 1; j >= 0; j--) {
        if (s[j] != letter) continue;
        if (j == n - 1) {
          gn -= g[j];
          g[j] = 0;
        } else {
          g[j + 1] += g[j];
          g[j] = 0;
        }
      }
    }
    if (0) {
      for (int k = 0; k < n; k++) {
        printf("%d ", g[k]);
      }
      printf(":gn=%2d", gn);
      printf("\n");
    }
  }
  printf("%d\n", gn);
  return 0;
}
