#include <bits/stdc++.h>
int main() {
  int i, j, k, l, n, q, g[200000], np[200000], bp[200000], bt[26], p[26], out;
  char s[200000], t[200000], d[200000];
  scanf("%d %d", &n, &q);
  scanf("%s", s);
  for (i = 0; i < q; i++) scanf(" %c %c", &t[i], &d[i]);
  for (i = 0; i < 26; i++) p[i] = bt[i] = -1;
  for (i = 0; i < n; i++) {
    g[i] = 1;
    np[i] = p[s[i] - 'A'];
    p[s[i] - 'A'] = i;
  }
  for (i = n - 1; i >= 0; i--) {
    bp[i] = bt[s[i] - 'A'];
    bt[s[i] - 'A'] = i;
  }
  for (out = i = 0; i < q; i++) {
    if (d[i] == 'L') {
      for (j = bt[t[i] - 'A']; j >= 0; j = bp[j]) {
        if (j == 0)
          out += g[j];
        else
          g[j - 1] += g[j];
        g[j] = 0;
      }
    } else {
      for (j = p[t[i] - 'A']; j >= 0; j = np[j]) {
        if (j == n - 1)
          out += g[j];
        else
          g[j + 1] += g[j];
        g[j] = 0;
      }
    }
  }
  printf("%d\n", n - out);
  return 0;
}
