#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  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;
    cin >> t >> d;
    int dif = d == 'L' ? -1 : 1;
    for (long i : index[t]) {
      if (i + dif < 0 || N <= i + dif)
        disap += S.at(i);
      else
        S.at(i + dif) += S.at(i);
      S.at(i) = 0;
    }
  }
  cout << N - disap << endl;
  return 0;
}
