#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q, ans = 0;
  string s;
  char t, d;
  cin >> n >> q >> s;
  vector<int> g(n + 2, 1);
  g[0] = g[n + 1] = 0;
  multimap<char, int> mp;
  for (int i = 0; i < s.size(); i++) {
    mp.insert(make_pair(s[i], i + 1));
  }
  for (int i = 0; i < q; i++) {
    cin >> t >> d;
    auto itr = mp.equal_range(t);
    if (d == 'L') {
      for (auto it = itr.first; it != itr.second; ++it) {
        g[it->second - 1] += g[it->second];
        g[it->second] = 0;
      }
    } else {
      for (auto it = (--itr.second);; --it) {
        g[it->second + 1] += g[it->second];
        g[it->second] = 0;
        if (it == itr.first) break;
      }
    }
  }
  for (int i = 1; i <= n; i++) ans += g[i];
  cout << ans << endl;
  return 0;
}
