#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> t(Q);
  vector<char> d(Q);
  for (int i = 0; i < (int)(Q); i++) cin >> t[i] >> d[i];
  vector<vector<int>> pos(256);
  for (int i = 0; i < (int)(N); i++) pos[s[i]].push_back(i);
  vector<int> count(N, 1);
  int res = N;
  for (int i = 0; i < (int)(Q); i++) {
    char c = t[i];
    int dir = (d[i] == 'L') ? -1 : 1;
    for (auto p : pos[c]) {
      int p_ = p + dir;
      if (p_ < 0 || p_ > N - 1) {
        res -= count[p];
        count[p] = 0;
      } else {
        count[p_] += count[p];
        count[p] = 0;
      }
    }
  }
  cout << res << endl;
  return 0;
}
