#include <bits/stdc++.h>
char sqid[100005];
std::vector<int> by_id[130];
int main(void) {
  int n, q;
  scanf("%d %d %s", &n, &q, &sqid);
  for (int i = 0; i < n; i++) by_id[sqid[i]].push_back(i);
  std::vector<int> golems(n, 1);
  for (int qq = 0; qq < q; qq++) {
    char ti, di;
    scanf(" %c %c", &ti, &di);
    if (di == 'L') {
      for (int i = 0; i < by_id[ti].size(); i++) {
        int index = by_id[ti][i];
        if (index > 0) golems[index - 1] += golems[index];
        golems[index] = 0;
      }
    } else {
      for (int i = by_id[ti].size() - 1; i >= 0; i--) {
        int index = by_id[ti][i];
        if (index < n - 1) golems[index + 1] += golems[index];
        golems[index] = 0;
      }
    }
  }
  int totalgolems = 0;
  for (int i = 0; i < n; i++) totalgolems += golems[i];
  printf("%d", totalgolems);
  return 0;
}
