#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<vector<int>> tmap(26);
  for (int i = 0; i < N; ++i) {
    tmap[s[i] - 'A'].push_back(i);
  }
  char t, d;
  vector<int> nv(N, 1);
  for (int i = 0; i < Q; ++i) {
    cin >> t >> d;
    if (d == 'R')
      for (int j = 0; j < tmap[t - 'A'].size(); ++j) {
        if (tmap[t - 'A'][j] + 1 < N)
          nv[tmap[t - 'A'][j] + 1] += nv[tmap[t - 'A'][j]];
        nv[tmap[t - 'A'][j]] = 0;
      }
    else if (d == 'L')
      for (int j = 0; j < tmap[t - 'A'].size(); ++j) {
        if (tmap[t - 'A'][j] - 1 >= 0)
          nv[tmap[t - 'A'][j] - 1] += nv[tmap[t - 'A'][j]];
        nv[tmap[t - 'A'][j]] = 0;
      }
  }
  int sum{0};
  for (int i = 0; i < N; ++i) {
    sum += nv[i];
  }
  cout << sum << endl;
}
