#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  getchar();
  vector<int> alp[26];
  for (int i = 0; i < n; i++) {
    int c = getchar();
    alp[c - 'A'].push_back(i);
  }
  int g[n];
  fill(g, g + n, 1);
  for (int i = 0; i < q; i++) {
    char t, d;
    scanf("\n%c %c", &t, &d);
    int len = (int)alp[t - 'A'].size();
    if (len == 0) continue;
    if (d == 'L') {
      for (int j = 0; j < len; j++) {
        int m = alp[t - 'A'][j];
        if (m > 0) g[m - 1] += g[m];
        g[m] = 0;
      }
    } else {
      for (int j = len - 1; j >= 0; j--) {
        int m = alp[t - 'A'][j];
        if (m < n - 1) g[m + 1] += g[m];
        g[m] = 0;
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) sum += g[i];
  printf("%d\n", sum);
  return 0;
}
