#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
vector<int> pos[26];
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  s = "0" + s + "0";
  vector<int> cnt(N + 2, 1);
  cnt[0] = cnt[N + 1] = 0;
  for (int i = 1; i <= N; ++i) {
    pos[s[i] - 'A'].push_back(i);
  }
  char c, dir;
  int ch;
  while (Q--) {
    cin >> c >> dir;
    ch = c - 'A';
    if (dir == 'L') {
      for (int i = 0; i < pos[ch].size(); ++i) {
        int p = pos[ch][i];
        cnt[p - 1] += cnt[p];
        cnt[p] = 0;
      }
    } else {
      for (int i = (int)pos[ch].size() - 1; i >= 0; --i) {
        int p = pos[ch][i];
        cnt[p + 1] += cnt[p];
        cnt[p] = 0;
      }
    }
  }
  printf("%i\n", N - cnt[0] - cnt[N + 1]);
  return 0;
}
