#include <bits/stdc++.h>
using namespace std;
ostream& operator<<(ostream& out, const vector<int>& v) {
  for (auto it = v.begin(); it != v.end(); it++) {
    cout << *it << " ";
  }
  return out;
}
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int>> cs(26);
  for (int i = 0; i < n; i++) {
    cs[s[i] - 'A'].push_back(i);
  }
  vector<int> golems(n + 2, 1);
  golems[0] = golems[n + 1] = 0;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    for (int idx : cs[t - 'A']) {
      if (d == 'R') {
        golems[idx + 2] += golems[idx + 1];
      } else {
        golems[idx] += golems[idx + 1];
      }
      golems[idx + 1] = 0;
    }
  }
  cout << (n - golems[0] - golems[n + 1]) << endl;
  return 0;
}
