#include <bits/stdc++.h>
int main() {
  int n, q, nlett[26] = {0};
  int alp[26][200000];
  scanf("%d%d", &n, &q);
  char s[n + 1];
  scanf("%s", s);
  for (int i = 0; i < n; i++) {
    alp[s[i] - 'A'][nlett[s[i] - 'A']] = i + 1;
    nlett[s[i] - 'A']++;
  }
  int arr[n + 2];
  for (int i = 0; i < n + 2; i++) {
    arr[i] = 1;
  }
  for (int i = 0; i < q; i++) {
    char t[2], d[2];
    scanf("%c %c", &t[0], &d[0]);
    if (nlett[t[0] - 'A'] > 0) {
      for (int j = 0; j < nlett[t[0] - 'A']; j++) {
        arr[alp[t[0] - 'A'][j]]--;
        if (d[0] == 'L') {
          arr[alp[t[0] - 'A'][j - 1]]++;
        } else {
          arr[alp[t[0] - 'A'][j + 1]]++;
        }
      }
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += arr[i];
  }
  printf("%lld", ans);
  return 0;
}
