#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  scanf("%d %d\n", &N, &Q);
  vector<int> Ng(N, 1);
  multimap<char, int> mp;
  char t;
  for (int i = 0; i < (int)(N); ++i) {
    scanf("%c", &t);
    mp.insert(make_pair(t, i));
  }
  scanf("\n");
  char d;
  int numG = N;
  for (int j = 0; j < (int)(Q); ++j) {
    scanf("%c %c\n", &t, &d);
    auto p = mp.equal_range(t);
    if (d == 'L') {
      if ((*(p.first)).second == 0) {
        numG -= Ng[0];
        Ng[0] = 0;
      }
      for (auto it = p.first; it != p.second; ++it) {
        if ((*it).second != 0) {
          Ng[((*it).second) - 1] += Ng[((*it).second)];
          Ng[((*it).second)] = 0;
        }
      }
    } else {
      auto q = p.second;
      --q;
      auto r = p.first;
      --r;
      if ((*q).second == N - 1) {
        numG -= Ng[N - 1];
        Ng[N - 1] = 0;
      }
      for (auto it = q; it != r; --it) {
        if ((*it).second != N - 1) {
          Ng[((*it).second) + 1] += Ng[((*it).second)];
          Ng[((*it).second)] = 0;
        }
      }
    }
  }
  printf("%d\n", numG);
}
