#include <bits/stdc++.h>
using namespace std;
char t[int(3e5)], d[int(3e5)];
int gn[int(3e5)];
vector<int> gp[26];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q, i, ans, direct;
  string s;
  cin >> N >> Q >> s;
  ans = N;
  for (int q = 0; q < Q; q++) cin >> t[q] >> d[q];
  fill(gn, gn + N, 1);
  for (int n = 0; n < N; n++) gp[int(s[n] - 'A')].push_back(n);
  int n, J;
  for (int q = 0; q < Q; q++) {
    i = int(t[q] - 'A');
    direct = d[q] == 'L' ? -1 : 1;
    J = gp[i].size();
    for (int j = 0; j < J; j++) {
      n = gp[i][0];
      gp[i].erase(gp[i].begin());
      if (n + direct == -1 || n + direct == N) {
        ans -= gn[n];
        gn[n] = 0;
      } else {
        if (gn[n + direct] == 0)
          gp[int(s[n + direct] - 'A')].push_back(n + direct);
        gn[n + direct] += gn[n];
        gn[n] = 0;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
