#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  char t;
  string d;
  cin >> n >> q >> s;
  vector<int> c(n);
  map<char, vector<int>> m;
  for (char i = 'A'; i < 'Z'; i++) {
    vector<int> v;
    m[i] = v;
  }
  for (int i = 0; i < n; i++) {
    m[s[i]].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    c[i] = 1;
  }
  for (int i = 0; i < q; i++) {
    cin >> t >> d;
    if (d == "L") {
      for (int p : m[t]) {
        if (c[p] == 0) continue;
        if (p > 0) c[p - 1] += c[p];
        c[p] = 0;
      }
    } else if (d == "R") {
      vector<int> ls = m[t];
      int lm = ls.size();
      for (int k = lm - 1; k >= 0; k--) {
        int p = ls[k];
        if (c[p] == 0) continue;
        if (p < n - 1) c[p + 1] += c[p];
        c[p] = 0;
      }
    }
  }
  int sum = 0;
  for (int x : c) {
    sum += x;
  }
  cout << sum << endl;
  return 0;
}
