#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long N, Q;
  cin >> N >> Q;
  char s0[200001];
  scanf("%s", s0);
  string s = s0;
  map<char, vector<long> > index;
  for (long i = (0); i < (N); ++i) {
    vector<long> pre = index[s.at(i)];
    pre.push_back(i);
    index[s.at(i)] = pre;
  }
  long disap = 0;
  vector<long> S(N, 1);
  for (long i = 0; i < (Q); ++i) {
    char t, d;
    scanf(" %c %c", &t, &d);
    int dif = d == 'L' ? -1 : 1;
    vector<long> tmp;
    for (long i : index[t]) {
      tmp.push_back(S.at(i));
      S.at(i) = 0;
    }
    for (long i = (0); i < (index[t].size()); ++i) {
      long lat = index[t].at(i) + dif;
      if (lat < 0 || N <= lat)
        disap += tmp.at(i);
      else
        S.at(lat) += tmp.at(i);
    }
  }
  cout << N - disap << endl;
  return 0;
}
