#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  cin >> n >> q;
  string a;
  cin >> a;
  vector<string> left;
  vector<string> right;
  for (int z = 0; z < q; z++) {
    string b, c;
    cin >> b >> c;
    if (c == "R") {
      right.push_back(b);
    } else {
      left.push_back(b);
    }
  }
  long long cu = left.size() - 1;
  long long count = 0;
  for (int z = 0; z < n; z++) {
    while (cu > -1 && left[cu][0] != a[z]) {
      cu--;
    }
    if (cu > -1) count++;
  }
  cu = 0;
  for (int z = n - 1; z > -1; z--) {
    while (cu < right.size() && right[cu][0] != a[z]) {
      cu++;
    }
    if (cu < right.size()) count++;
  }
  cout << max((long long)0, n - count) << endl;
  cin >> n;
}
