#include <bits/stdc++.h>
int main(void) {
  int n, q;
  static char str[200000];
  static char t[200000], d[200000];
  static int mass[200000];
  int i, j;
  int ans = 0;
  static int gorem[26][200000];
  int soe[26];
  for (i = 0; i < 26; i++) {
    soe[i] = 0;
  }
  scanf("%d %d", &n, &q);
  scanf("%s", str);
  ans = n;
  for (i = 0; i < n; i++) {
    mass[i] = 1;
    gorem[str[i] - 'A'][soe[str[i] - 'A']] = i;
    soe[str[i] - 'A']++;
  }
  for (i = 0; i < 26; i++) {
    gorem[i][soe[i]] = -99;
  }
  for (i = 0; i < q; i++) {
    scanf(" %c %c", &t[i], &d[i]);
    for (j = 0; gorem[t[i] - 'A'][j] != -99; j++) {
      if (d[i] == 'L') {
        if (gorem[t[i] - 'A'][j] - 1 < 0) {
          ans -= mass[gorem[t[i] - 'A'][j]];
          mass[gorem[t[i] - 'A'][j]] = 0;
        } else {
          mass[gorem[t[i] - 'A'][j] - 1] += mass[gorem[t[i] - 'A'][j]];
          mass[gorem[t[i] - 'A'][j]] = 0;
        }
      } else if (d[i] == 'R') {
        if (gorem[t[i] - 'A'][j] + 1 >= n) {
          ans -= mass[gorem[t[i] - 'A'][j]];
          mass[gorem[t[i] - 'A'][j]] = 0;
        } else {
          mass[gorem[t[i] - 'A'][j] + 1] += mass[gorem[t[i] - 'A'][j]];
          mass[gorem[t[i] - 'A'][j]] = 0;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
