#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  int N1 = N - 1;
  set<int> abc[26];
  vector<int> grids(N, 1);
  for (int i = 0; i < N; i++) abc[s[i] - 'A'].insert(i);
  char t, d;
  for (int i = 0; i < Q; i++) {
    cin >> t >> d;
    auto a = abc[t - 'A'];
    if (d == 'L') {
      auto j = a.begin();
      if (j == a.end()) break;
      if (*j == 0) {
        grids[0] = 0;
        j++;
      }
      for (; j != a.end(); j++) {
        if (*j > 0) grids[*j - 1] += grids[*j];
        grids[*j] = 0;
      }
    } else {
      auto j = a.rbegin();
      if (j == a.rend()) break;
      if (*j == N1) {
        grids[N1] = 0;
        j++;
      }
      for (; j != a.rend(); j++) {
        grids[*j + 1] += grids[*j];
        grids[*j] = 0;
      }
    }
  }
  int ans = 0;
  for (auto i : grids) ans += i;
  cout << ans << endl;
  return 0;
}
