#include <bits/stdc++.h>
int main() {
  int n, q;
  char s[200000];
  int p[200000];
  int i, j;
  char t[200000], d[200000];
  int move = 1;
  int count = 0;
  scanf("%d %d", &n, &q);
  scanf("%s", s);
  for (i = 0; i < q; i++) {
    p[i] = i;
  }
  for (i = 0; i < q; i++) {
    scanf("%s %s", t, d);
    if (d[i] == 'L') move = -1;
    for (j = 0; j < q; j++) {
      if (s[j] == t[i]) s[j] += move;
    }
  }
  for (i = 0; i < q; i++) {
    if (s[i] >= 0 && s[i] < q) count++;
  }
  printf("%d\n", count);
  return (0);
}
