#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<int> G(N, 1);
  vector<vector<int>> M(26, vector<int>());
  for (int i = 0; i < N; ++i) M[s[i] - 'A'].push_back(i);
  for (int i = 0; i < Q; ++i) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (auto &p : M[t - 'A']) {
        if (Q - i < min(N - p, p)) continue;
        if (G[p] == 0) continue;
        if (p > 0) G[p - 1] += G[p];
        G[p] = 0;
      }
    } else {
      for (int i = M[t - 'A'].size() - 1; i >= 0; --i) {
        int p = M[t - 'A'][i];
        if (Q - i < min(N - p, p)) continue;
        if (G[p] == 0) continue;
        if (p < N - 1) G[p + 1] += G[p];
        G[p] = 0;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; ++i) ans += G[i];
  cout << ans << endl;
  return 0;
}
