#include <bits/stdc++.h>
using namespace std;
int n, m;
string s;
char ths, r;
int now[200005];
vector<int> alp[30];
int main() {
  cin >> n >> m >> s;
  for (int i = 0; i < n; i++) alp[s[i] - 'A'].push_back(i);
  for (int i = 0; i < 200005; i++) now[i] = 1;
  while (m--) {
    cin >> ths >> r;
    int l = ths - 'A';
    if (r == 'L') {
      for (int i = 0; i < alp[l].size(); i++) {
        if (alp[l][i] != 0) now[alp[l][i] - 1] += now[alp[l][i]];
        now[alp[l][i]] = 0;
      }
    } else {
      for (int i = alp[l].size() - 1; i >= 0; i--) {
        if (alp[l][i] != n - 1) now[alp[l][i] + 1] += now[alp[l][i]];
        now[alp[l][i]] = 0;
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) sum += now[i];
  cout << sum << endl;
  return 0;
}
