#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int Q;
  cin >> Q;
  string s;
  cin >> s;
  vector<int> moji[26];
  for (int i = 1; i <= N; i++) {
    moji[s[i - 1] - 'A'].push_back(i);
  }
  int t[200001] = {};
  char d[200001] = {};
  for (int i = 0; i < Q; i++) {
    char temp;
    cin >> temp >> d[i];
    t[i] = temp - 'A';
  }
  int dead[200002] = {};
  dead[0] = 1;
  dead[N + 1] = 1;
  for (int q = Q - 1; q >= 0; q--) {
    vector<int> zero;
    vector<int> one;
    for (int i : moji[t[q]]) {
      if (d[q] == 'R') {
        if (dead[i + 1] == 1) {
          one.push_back(i);
        } else {
          zero.push_back(i);
        }
      } else if (d[q] == 'L') {
        if (dead[i - 1] == 1) {
          one.push_back(i);
        } else {
          zero.push_back(i);
        }
      }
    }
    for (int i : zero) {
      dead[i] = 0;
    }
    for (int i : one) {
      dead[i] = 1;
    }
  }
  int ans = N;
  for (int i = 1; i <= N; i++) {
    ans -= dead[i];
  }
  cout << ans << endl;
  return 0;
}
