#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  map<int, int> step[26];
  for (int i = 0; i < (N); i++) {
    step[S[i] - 'A'][i] = 1;
  }
  int answer = N;
  for (int i = 0; i < (Q); i++) {
    char t, d;
    cin >> t >> d;
    for (auto& pos : step[t - 'A']) {
      int j = pos.first;
      int num = pos.second;
      if (d == 'L') {
        if (j == 0) {
          answer -= num;
        } else {
          step[S[j - 1] - 'A'][j - 1] += num;
        }
      } else {
        if (pos.first == N - 1) {
          answer -= pos.second;
        } else {
          step[S[j + 1] - 'A'][j + 1] += num;
        }
      }
    }
    step[t - 'A'].clear();
  }
  cout << answer << endl;
  return 0;
}
