#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<char> t(q), d(q);
  for (int i = 0; i < q; i++) {
    cin >> t.at(i) >> d.at(i);
  }
  multimap<char, int> m;
  for (int i = 0; i < (int)s.size(); i++) {
    m.emplace(s.at(i), i);
  }
  vector<int> g((int)s.size() + 2, 1);
  for (int i = 0; i < q; i++) {
    if (d.at(i) == 'R') {
      auto p = m.equal_range(t.at(i));
      for (auto it = p.first; it != p.second; ++it) {
        if (g.at((it->second) + 1) > 0) {
          g.at((it->second) + 2) += g.at((it->second) + 1);
          g.at((it->second) + 1) = 0;
        }
      }
    } else {
      auto p = m.equal_range(t.at(i));
      for (auto it = p.first; it != p.second; ++it) {
        if (g.at((it->second) + 1) > 0) {
          g.at(it->second) += g.at((it->second) + 1);
          g.at((it->second) + 1) = 0;
        }
      }
    }
  }
  int cnt = 0;
  for (int i = 1; i < (int)g.size() - 1; i++) {
    cnt += g.at(i);
  }
  cout << cnt << endl;
}
