#include <bits/stdc++.h>
using namespace std;
int N, Q;
const int maxn = 100005;
vector<int> vi[256];
int nums[maxn];
int get_int() {
  int x;
  scanf("%d", &x);
  return x;
}
double get_double() {
  double x;
  scanf("%lf", &x);
  return x;
}
long long get_long() {
  long long x;
  scanf("%lld", &x);
  return x;
}
void tests() { ; }
int main() {
  scanf("%d %d", &N, &Q);
  getchar();
  for (int i = (0); i < (N); i++) {
    char ch = getchar();
    vi[ch].push_back(i);
  }
  for (int i = (0); i < (N); i++) nums[i] = 1;
  int k = 0;
  for (int i = (0); i < (Q); i++) {
    string s;
    string instr;
    cin >> s >> instr;
    if (instr == "L") {
      char ch = s[0];
      int num = ch;
      for (int i = (0); i < (vi[num].size()); i++) {
        int pos = vi[num][i];
        if (pos == 0) {
          k += nums[pos];
          nums[pos] = 0;
        } else {
          nums[pos - 1] += nums[pos];
          nums[pos] = 0;
        }
      }
    }
    if (instr == "R") {
      char ch = s[0];
      int num = ch;
      for (int i = (0); i < (vi[num].size()); i++) {
        int pos = vi[num][i];
        if (pos == N - 1) {
          k += nums[pos];
          nums[pos] = 0;
        } else {
          nums[pos + 1] += nums[pos];
          nums[pos] = 0;
        }
      }
    }
  }
  printf("%d\n", N - k);
  return 0;
}
