#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  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);
  }
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; ++i) cin >> t[i] >> d[i];
  for (int i = 0; i < Q; ++i) {
    for (auto &p : M[t[i] - 'A']) {
      if (G[p] == 0) continue;
      if (d[i] == 'L') {
        if (p > 0) G[p - 1] += G[p];
      } else {
        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;
}
