#include <bits/stdc++.h>
int main() {
  int N, Q;
  static char s[20001];
  scanf("%d%d%s", &N, &Q, s);
  std::vector<int> tbl[32];
  for (int i = 0; i < N; i++) {
    tbl[s[i] - 'A'].push_back(i);
  }
  int ans = N;
  for (int i = 0; i < Q; i++) {
    char t[2], d[2];
    scanf("%s%s", t, d);
    auto &v = tbl[t[0] - 'A'];
    int diff = (d[0] == 'L') ? -1 : 1;
    for (int idx : v) {
      idx += diff;
      if (idx < 0 || idx >= N) {
        ans--;
      } else {
        tbl[s[idx] - 'A'].push_back(idx);
      }
    }
    v.clear();
    v.shrink_to_fit();
  }
  printf("%d\n", ans);
  return 0;
}
