#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q, gap = 0;
  cin >> N >> Q;
  char s[N];
  char t, d;
  int count[N];
  for (int i = 0; i < N; i++) count[i] = 1;
  scanf("%s", s);
  for (int i = 0; i < Q; i++) {
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 0; j < N; j++) {
        if (t == s[j]) {
          if (j == 0) {
            gap += count[j];
            count[j] = 0;
          } else {
            count[j - 1] += count[j];
            count[j] = 0;
          }
        }
      }
    } else {
      for (int j = 0; j < N; j++) {
        if (t == s[N - j - 1]) {
          if (j == 0) {
            gap += count[N - 1];
            count[N - 1] = 0;
          } else {
            count[N - j] += count[N - j - 1];
            count[N - j - 1] = 0;
          }
        }
      }
    }
  }
  cout << N - gap << endl;
  return 0;
}
