#include <bits/stdc++.h>
using namespace std;
int N, Q;
const int maxn = 200005;
map<int, int> vi[256];
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;
}
vector<char> vc;
void tests() { ; }
int main() {
  scanf("%d %d", &N, &Q);
  getchar();
  for (int i = (0); i < (N); i++) {
    char ch = getchar();
    vi[ch][i] = 1;
    vc.push_back(ch);
  }
  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;
      map<int, int> copys = vi[num];
      vi[num].clear();
      for (auto &a : copys) {
        int pos = a.first;
        if (pos == 0) {
          k += a.second;
        } else {
          char ch2 = vc[pos - 1];
          vi[ch2][pos - 1] += a.second;
        }
      }
    }
    if (instr == "R") {
      char ch = s[0];
      int num = ch;
      map<int, int> copys = vi[num];
      vi[num].clear();
      for (auto &a : copys) {
        int pos = a.first;
        if (pos == N - 1) {
          k += a.second;
        } else {
          char ch2 = vc[pos + 1];
          vi[ch2][pos + 1] += a.second;
        }
      }
    }
  }
  printf("%d\n", N - k);
  return 0;
}
