#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector<int> f((int)S.size(), 1);
  vector<vector<int> > access((26), vector<int>(0));
  ;
  for (auto i = (0); (i) < ((int)S.size()); ++(i)) {
    int index = S[i] - 'A';
    access[index].push_back(i);
  }
  for (int z = 0; z < Q; ++z) {
    char t, d;
    cin >> t >> d;
    int aInd = t - 'A';
    for (auto i = (0); (i) < ((int)access[aInd].size()); ++(i)) {
      int fInd = access[aInd][i];
      if (d == 'L') {
        if (fInd == 0)
          f[fInd] = 0;
        else {
          int tmp = f[fInd];
          f[fInd] = 0;
          f[fInd - 1] += tmp;
        }
      }
      if (d == 'R') {
        if (fInd == N - 1)
          f[fInd] = 0;
        else {
          int tmp = f[fInd];
          f[fInd] = 0;
          f[fInd + 1] += tmp;
        }
      }
    }
  }
  int sum = 0;
  for (auto i = f.begin(); i != f.end(); ++i) sum += *i;
  cout << sum << endl;
}
