#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 3, q = 4;
  string s;
  cin >> n >> q;
  cin >> s;
  vector<int> vt(q, 0);
  vector<int> vd(q, 0);
  for (int i = 0; i < q; ++i) {
    char t, d;
    cin >> t >> d;
    vt[i] = int(t - 'A');
    vd[i] = (d == 'L') ? -1 : 1;
  }
  vector<vector<int>> rp(26, vector<int>());
  for (int i = 0; i < n; ++i) {
    rp[int(s[i] - 'A')].push_back(i + 1);
  }
  for (int i = 0; i < q; ++i) {
    int cur = vt[i];
    int del = vd[i];
    for (int j = 0; j < rp[cur].size(); ++j) {
      if (rp[cur][j] >= 1 && rp[cur][j] <= n) {
        rp[cur][j] += del;
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < rp.size(); ++i) {
    for (int j = 0; j < rp[i].size(); ++j) {
      if (rp[i][j] >= 1 && rp[i][j] <= n) {
        cnt += 1;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
