#include <bits/stdc++.h>
int sub(char *str, int *list, int n, char t, char d) {
  int i, ans = 0;
  if (d == 'L') {
    for (i = 0; i < n; ++i) {
      if (str[i] == t) {
        if (i == 0) {
          ans += list[i];
          list[i] = 0;
        } else {
          list[i - 1] += list[i];
          list[i] = 0;
        }
      }
    }
  } else if (d == 'R') {
    for (i = n - 1; i >= 0; --i) {
      if (str[i] == t) {
        if (i == n - 1) {
          ans += list[i];
          list[i] = 0;
        } else {
          list[i + 1] += list[i];
          list[i] = 0;
        }
      }
    }
  }
  return ans;
}
int main() {
  int n, q, i, ans;
  char t, d;
  scanf("%d %d", &n, &q);
  ans = n;
  char *str = (char *)malloc((n + 4) * sizeof(char));
  int *list = (int *)malloc((n + 4) * sizeof(int));
  for (i = 0; i < n; ++i) {
    list[i] = 1;
  }
  scanf("%s", str);
  fgetc(stdin);
  for (i = 0; i < q; ++i) {
    scanf("%c %c", &t, &d);
    fgetc(stdin);
    ans -= sub(str, list, n, t, d);
  }
  printf("%d\n", ans);
  return 0;
}
