#include <bits/stdc++.h>
using namespace std;
int n, q;
char ss[200003];
int gol[200003];
typedef struct data {
  int position;
};
vector<data> a[28];
void input() {
  scanf("%d %d", &n, &q);
  scanf("%s", ss);
  getchar();
  for (int i = 0; i < n; i++) {
    data inn;
    inn.position = i;
    gol[i] = 1;
    a[ss[i] - 'A'].push_back(inn);
  }
}
void process() {
  for (int i = 0; i < q; i++) {
    char spell, direct;
    scanf("%c %c", &spell, &direct);
    getchar();
    if (direct == 'L') {
      for (auto &it : a[spell - 'A']) {
        if (it.position == 0) {
          gol[it.position] = 0;
        } else {
          gol[it.position - 1] += gol[it.position];
          gol[it.position] = 0;
        }
      }
    } else if (direct == 'R') {
      for (auto &it : a[spell - 'A']) {
        if (it.position == n - 1) {
          gol[it.position] = 0;
        } else {
          gol[it.position + 1] += gol[it.position];
          gol[it.position] = 0;
        }
      }
    }
  }
}
void output() {
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += gol[i];
  }
  printf("%d", sum);
}
int main() {
  input();
  process();
  output();
  return 0;
}
