#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; i++) cin >> t[i] >> d[i];
  multimap<char, int> alphabet;
  for (int i = 0; i < s.length(); i++) alphabet.emplace(s[i], i);
  vector<int> golem(N, 1);
  for (int i = 0; i < Q; i++) {
    auto p = alphabet.equal_range(t[i]);
    if (d[i] == 'L') {
      for (auto it = p.first; it != p.second; it++) {
        int num = golem[it->second];
        golem[it->second] = 0;
        if (it->second != 0) {
          golem[it->second - 1] += num;
        }
      }
    } else {
      p.first--;
      p.second--;
      for (auto it = p.second; it != p.first; it--) {
        int num = golem[it->second];
        golem[it->second] = 0;
        if (it->second != (N - 1)) {
          golem[it->second + 1] += num;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) ans += golem[i];
  cout << ans << endl;
  return 0;
}
