#include <bits/stdc++.h>
using namespace std;
int n, q;
string s;
int c[200002];
vector<int> ps[30];
int main(void) {
  cin >> n >> q;
  cin >> s;
  for (int i = (0), ilen = (n); i < ilen; ++i) {
    int x = s[i] - 'A';
    ps[x].push_back(i);
  }
  int res = n;
  for (int i = (0), ilen = (n); i < ilen; ++i) {
    c[i + 1] = 1;
  }
  for (int i = (0), ilen = (q); i < ilen; ++i) {
    string t, d;
    cin >> t >> d;
    int x = t[0] - 'A';
    if (d[0] == 'L') {
      for (auto ss : ps[x]) {
        c[ss] += c[ss + 1];
        c[ss + 1] = 0;
      }
    } else {
      for (int j = ps[x].size() - 1; j >= 0; j--) {
        auto ss = ps[x][j];
        c[ss + 2] += c[ss + 1];
        c[ss + 1] = 0;
      }
    }
  }
  cout << (n - c[0] - c[n + 1]) << endl;
  return 0;
}
