#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> t, d;
  char ti, di;
  for (int i = 0; i < Q; i++) {
    cin >> ti >> di;
    t.push_back(ti);
    d.push_back(di);
  }
  vector<vector<int>> index(26);
  for (int i = 0; i < N; i++) {
    index[s[i] - 'A'].push_back(i);
  }
  vector<int> golem(N, 1);
  int elim = 0;
  for (int i = 0; i < Q; i++) {
    for (auto j : index[t[i] - 'A']) {
      if (j != 0 && d[i] == 'L') {
        golem[j - 1] += golem[j];
      } else if (j != N - 1 && d[i] == 'R') {
        golem[j + 1] += golem[j];
      } else {
        elim += golem[j];
      }
      golem[j] = 0;
    }
  }
  cout << N - elim << endl;
  return 0;
}
