#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int Q;
  cin >> Q;
  string s;
  cin >> s;
  int t[200001] = {};
  char d[200001] = {};
  for (int i = 0; i < Q; i++) {
    char temp;
    cin >> temp >> d[i];
    t[i] = temp - 'A';
  }
  int turn[200002] = {};
  turn[0] = Q + 1;
  turn[N + 1] = Q + 1;
  vector<pair<int, int> > L, R;
  for (int i = 0; i < Q; i++) {
    if (d[i] == 'L') {
      L.push_back(make_pair(t[i], i + 1));
    } else {
      R.push_back(make_pair(t[i], i + 1));
    }
  }
  sort(L.begin(), L.end());
  sort(R.begin(), R.end());
  for (int i = 1; i <= N; i++) {
    int moji = s[i - 1] - 'A';
    int temp = lower_bound(L.begin(), L.end(), make_pair(moji, turn[i - 1])) -
               L.begin();
    temp--;
    if (temp < 0 || L[temp].first != moji) {
      continue;
    } else {
      turn[i] = max(turn[i], L[temp].second);
    }
  }
  for (int i = N; i >= 1; i--) {
    int moji = s[i - 1] - 'A';
    int temp = lower_bound(R.begin(), R.end(), make_pair(moji, turn[i + 1])) -
               R.begin();
    temp--;
    if (temp < 0 || R[temp].first != moji) {
      continue;
    } else {
      turn[i] = max(turn[i], R[temp].second);
    }
  }
  int ans = N;
  for (int i = 1; i <= N; i++) {
    if (turn[i] > 0) {
      ans--;
    }
  }
  cout << ans << endl;
  return 0;
}
