#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  map<string, vector<int> > inmap;
  string s;
  cin >> s;
  vector<int> pos(N, 1);
  for (int i = 0; i < N; i++) {
    if (inmap.count(s.substr(i, 1)))
      inmap[s.substr(i, 1)].push_back(i);
    else
      inmap[s.substr(i, 1)] = {i};
  }
  int ret = N;
  for (size_t i = 0; i < Q; i++) {
    string t, d;
    cin >> t >> d;
    if (d == "L") {
      for (auto it = inmap[t].begin(); it != inmap[t].end(); it = next(it)) {
        if ((*it) == 0)
          ret -= pos[*it];
        else
          pos[*it - 1] += pos[*it];
        pos[*it] = 0;
      }
    } else {
      for (auto it = inmap[t].begin(); it != inmap[t].end(); it = next(it)) {
        if (*it == N - 1)
          ret -= pos[*it];
        else
          pos[*it + 1] += pos[*it];
        pos[*it] = 0;
      }
    }
  }
  cout << ret << endl;
  return 0;
}
