#include <bits/stdc++.h>
int main(void) {
  int N, Q, total, i, j, k;
  char t, d;
  scanf("%d %d", &N, &Q);
  getchar();
  char str[N];
  int golem[N];
  for (i = 0; i < N; i++) golem[i] = 1;
  total = N;
  scanf("%s", str);
  getchar();
  char alpha[26];
  int alnum[26] = {}, alplace[26][N];
  alpha[0] = 'A';
  for (i = 1; i < 26; i++) alpha[i] = alpha[i - 1] + 1;
  for (i = 0; i < N; i++) {
    for (j = 0; j < 26; j++) {
      if (str[i] == alpha[j]) {
        alplace[j][alnum[j]] = i;
        alnum[j]++;
        break;
      }
    }
  }
  for (i = 0; i < Q; i++) {
    scanf("%c %c", &t, &d);
    getchar();
    if (d == 'L') {
      for (j = 0; j < 26; j++) {
        if (t == alpha[j]) {
          for (k = 0; k < alnum[j]; k++) {
            if (alplace[j][k] == 0)
              total -= golem[alplace[j][k]];
            else
              golem[alplace[j][k] - 1] += golem[alplace[j][k]];
            golem[alplace[j][k]] = 0;
          }
          break;
        }
      }
    } else if (d == 'R') {
      for (j = 0; j < 26; j++) {
        if (t == alpha[j]) {
          for (k = 0; k < alnum[j]; k++) {
            if (alplace[j][k] == N - 1)
              total -= golem[alplace[j][k]];
            else
              golem[alplace[j][k] + 1] += golem[alplace[j][k]];
            golem[alplace[j][k]] = 0;
          }
          break;
        }
      }
    }
  }
  printf("%d\n", total);
  return 0;
}
