#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  vector<int> num_g(n, 1);
  multimap<char, int> g;
  for (int i = 0; i < n; i++) {
    char c;
    cin >> c;
    g.emplace(c, i);
  }
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    auto it = g.lower_bound(t);
    auto last = g.upper_bound(t);
    if (d == 'L') {
      for (it; it != last; it++) {
        int index = (*it).second;
        if (index != 0) num_g[index - 1] += num_g[index];
        num_g[index] = 0;
      }
    }
    if (d == 'R') {
      multimap<int, int> change;
      for (it; it != last; it++) {
        int index = (*it).second;
        if (index != n) change.emplace(index + 1, num_g[index]);
        num_g[index] = 0;
      }
      for (auto it2 = change.begin(); it2 != change.end(); it2++) {
        num_g[(*it2).first] += (*it2).second;
      }
    }
  }
  int ans = accumulate(num_g.begin(), num_g.end(), 0);
  cout << ans << endl;
}
