#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
char s[N];
int nxt[N][30], pre[N][30];
int a[N];
int n, m;
int main() {
  int i, j;
  scanf(" %d %d %s ", &n, &m, s + 1);
  for (i = n; i >= 0; i--)
    for (j = 0; j <= 25; j++)
      if (s[i] - 'A' == j)
        nxt[i][j] = i;
      else
        nxt[i][j] = nxt[i + 1][j];
  for (i = 1; i <= n + 1; i++)
    for (j = 0; j <= 25; j++)
      if (s[i] - 'A' == j)
        pre[i][j] = i;
      else
        pre[i][j] = pre[i - 1][j];
  for (i = 1; i <= n; i++) a[i] = 1;
  while (m--) {
    char t, d;
    scanf("%c %c ", &t, &d);
    if (d == 'L') {
      for (i = nxt[0][t - 'A']; i; i = nxt[i + 1][t - 'A'])
        a[i - 1] += a[i], a[i] = 0;
      a[0] = 0;
    }
    if (d == 'R') {
      for (i = pre[n + 1][t - 'A']; i; i = pre[i - 1][t - 'A'])
        a[i + 1] += a[i], a[i] = 0;
      a[n + 1] = 0;
    }
  }
  int res = 0;
  for (i = 1; i <= n; i++) res += a[i];
  printf("%d\n", res);
  return 0;
}
