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