#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> t(Q);
  vector<char> d(Q);
  for (int i = 0; i < Q; i++) {
    cin >> t.at(i) >> d.at(i);
  }
  struct na {
    char alph;
    vector<long long int> loc;
  };
  struct na nalph[26];
  string ah = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for (int i = 0; i < 26; i++) {
    nalph[i].alph = ah.at(i);
  }
  for (long long int i = 0; i < N; i++) {
    for (int j = 0; j < 26; j++) {
      if (s.at(i) == ah.at(j)) {
        nalph[j].loc.push_back(i);
        break;
      }
    }
  }
  vector<long long int> numb(N, 1);
  long long int sum = N;
  for (long long int i = 0; i < Q; i++) {
    for (int j = 0; j < 26; j++) {
      if (t.at(i) == ah.at(j)) {
        long long int n = nalph[j].loc.size();
        for (long long int k = 0; k < n; k++) {
          if (numb.at(nalph[j].loc.at(k)) > 0) {
            if (d.at(i) == 'R') {
              if (nalph[j].loc.at(k) != N - 1) {
                numb.at(nalph[j].loc.at(k) + 1) += numb.at(nalph[j].loc.at(k));
              } else {
                sum -= numb.at(nalph[j].loc.at(k));
              }
              numb.at(nalph[j].loc.at(k)) = 0;
            } else {
              if (nalph[j].loc.at(k) != 0) {
                numb.at(nalph[j].loc.at(k) - 1) += numb.at(nalph[j].loc.at(k));
              } else {
                sum -= numb.at(nalph[j].loc.at(k));
              }
              numb.at(nalph[j].loc.at(k)) = 0;
            }
          }
        }
      }
    }
  }
  cout << sum << endl;
  return 0;
}
