#include <bits/stdc++.h>
using namespace std;
int s[30][200007];
int q[30][2];
int p[30][2];
int main() {
  int n, Q;
  scanf("%d%d", &n, &Q);
  char ch, op;
  memset(s, 0, sizeof s);
  for (register int i = (0); i < (n); i++)
    p[i][0] = q[i][0] = 0, p[i][1] = q[i][1] = n;
  for (register int i = (1); i <= (n); i++) {
    do ch = getchar();
    while (ch <= ' ');
    for (register int j = (0); j < (26); j++) {
      s[j][i] = s[j][i - 1] + (ch == ('A' + j));
    }
  }
  for (register int i = (0); i < (Q); i++) {
    do ch = getchar();
    while (ch <= ' ');
    do op = getchar();
    while (op <= ' ');
    int dx = (op == 'L' ? 1 : -1);
    q[ch - 'A'][0] = min(max(0, q[ch - 'A'][0] + dx), n);
    q[ch - 'A'][1] = min(max(0, q[ch - 'A'][1] + dx), n);
    p[ch - 'A'][0] = max(p[ch - 'A'][0], q[ch - 'A'][0]);
    p[ch - 'A'][1] = min(p[ch - 'A'][1], q[ch - 'A'][1]);
  }
  int ans = 0;
  for (register int i = (0); i < (26); i++) {
    if (p[i][1] > p[i][0]) ans += s[i][p[i][1]] - s[i][p[i][0]];
  }
  printf("%d\n", ans);
  return 0;
}
