#include <bits/stdc++.h>
int diff[4][2] = {
    {0, -1},
    {-1, 0},
    {1, 0},
    {0, 1},
};
char s[200001];
int pos[26][200000];
int cntC[26];
int cnt[200000];
int Min(int a, int b) { return (a) < (b) ? (a) : (b); }
int Max(int a, int b) { return (a) > (b) ? (a) : (b); }
long long Minl(long long a, long long b) { return (a) < (b) ? (a) : (b); }
void Swap(int *a, int *b) {
  int tmp = *a;
  *a = *b;
  *b = tmp;
}
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  scanf("%s", s);
  for (int i = 0, i_len = (int)(strlen(s)); i < i_len; i++) {
    cnt[i] = 1;
  }
  for (int i = 0, i_len = (int)(strlen(s)); i < i_len; i++) {
    int c = s[i] - 'A';
    pos[c][cntC[c]] = i;
    cntC[c]++;
  }
  int ans = n;
  for (int i = 0, i_len = (int)(q); i < i_len; i++) {
    char t, d;
    scanf(" %c %c", &t, &d);
    int c = t - 'A';
    if (d == 'L') {
      for (int j = 0, j_len = (int)(cntC[c]); j < j_len; j++) {
        if (pos[c][j] != 0) {
          cnt[pos[c][j] - 1] += cnt[pos[c][j]];
          cnt[pos[c][j]] = 0;
        } else {
          ans -= cnt[0];
          cnt[0] = 0;
        }
      }
    } else {
      for (int j = (int)(cntC[c]) - 1; j >= 0; j--) {
        if (pos[c][j] != n - 1) {
          cnt[pos[c][j] + 1] += cnt[pos[c][j]];
          cnt[pos[c][j]] = 0;
        } else {
          ans -= cnt[n - 1];
          cnt[n - 1] = 0;
        }
      }
    }
  }
  printf("%d\n", (ans));
}
