#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 n, q;
string s;
vector<set<int>> cs(26);
int main() {
  cin >> n >> q;
  cin >> s;
  for (int i = 0; i < n; i++) {
    cs[s[i] - 'A'].insert(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;
    set<int> changed;
    for (int idx : cs[t - 'A']) {
      if (d == 'R') {
        golems[idx + 2] += golems[idx + 1];
        if (idx + 1 < n) {
          changed.insert(idx + 1);
        }
      } else {
        golems[idx] += golems[idx + 1];
        if (idx - 1 >= 0) {
          changed.insert(idx - 1);
        }
      }
      golems[idx + 1] = 0;
      changed.insert(idx);
    }
    for (int idx : changed) {
      if (golems[idx + 1] == 0) {
        auto& st = cs[s[idx] - 'A'];
        auto itr = st.find(idx);
        if (itr != st.end()) {
          st.erase(itr);
        }
      } else {
        cs[s[idx] - 'A'].insert(idx);
      }
    }
  }
  cout << (n - golems[0] - golems[n + 1]) << endl;
  return 0;
}
