#include <bits/stdc++.h>
int main(void) {
  char str[200001];
  char t[200000][2][2];
  int masu_count[200000] = {0};
  int masu_mozi[26][200000];
  int masu_mozi_kosu[26] = {0};
  int n, q;
  int count;
  int i, j;
  scanf("%d%d", &n, &q);
  scanf("%s", str);
  count = n;
  for (i = 0; i < n; i++) {
    masu_count[i] = 1;
    masu_mozi_kosu[str[i] - 'A']++;
    masu_mozi[str[i] - 'A'][masu_mozi_kosu[str[i] - 'A'] - 1] = i;
  }
  for (i = 0; i < q; i++) {
    scanf("%s%s", t[i][0], t[i][1]);
  }
  for (i = 0; i < q; i++) {
    if (t[i][1][0] == 'R') {
      for (j = masu_mozi_kosu[t[i][0][0] - 'A'] - 1; j >= 0; j--) {
        if (masu_mozi[t[i][0][0] - 'A'][j] == (n - 1)) {
          count -= masu_count[masu_mozi[t[i][0][0] - 'A'][j]];
          masu_count[masu_mozi[t[i][0][0] - 'A'][j]] = 0;
        } else {
          masu_count[masu_mozi[t[i][0][0] - 'A'][j] + 1] +=
              masu_count[masu_mozi[t[i][0][0] - 'A'][j]];
          masu_count[masu_mozi[t[i][0][0] - 'A'][j]] = 0;
        }
      }
    } else {
      for (j = 0; j < masu_mozi_kosu[t[i][0][0] - 'A']; j++) {
        if (masu_mozi[t[i][0][0] - 'A'][j] == 0) {
          count -= masu_count[masu_mozi[t[i][0][0] - 'A'][j]];
          masu_count[masu_mozi[t[i][0][0] - 'A'][j]] = 0;
        } else {
          masu_count[masu_mozi[t[i][0][0] - 'A'][j] - 1] +=
              masu_count[masu_mozi[t[i][0][0] - 'A'][j]];
          masu_count[masu_mozi[t[i][0][0] - 'A'][j]] = 0;
        }
      }
    }
  }
  printf("%d", count);
  return 0;
}
