#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, q;
  cin >> n >> q;
  vector<vector<int>> pos(26);
  vector<int> num(n + 2, 1);
  num[0] = 0;
  num[n + 1] = 0;
  for (int i = 1; i <= n; i++) {
    char c;
    cin >> c;
    pos[c - 'A'].push_back(i);
  }
  for (int i = 0; i <= q - 1; i++) {
    char c, op;
    cin >> c >> op;
    if (op == 'L') {
      for (int e : pos[c - 'A']) {
        num[e - 1] += num[e];
        num[e] = 0;
      }
    } else {
      for (int e : pos[c - 'A']) {
        num[e + 1] += num[e];
        num[e] = 0;
      }
    }
  }
  cout << n - num[0] - num[n + 1];
  return 0;
}
