#include <bits/stdc++.h>
char str[100002];
int N, Q;
char s[200001];
char t[200001];
char d[200001];
int panel[200001];
int target[26][200001];
int target_num[26];
void receive_input() {
  fgets(str, sizeof(str), stdin);
  sscanf(str, "%d %d", &N, &Q);
  fgets(str, sizeof(str), stdin);
  sscanf(str, "%s", s);
  for (size_t i = 0; i < Q; i++) {
    fgets(str, sizeof(str), stdin);
    sscanf(str, "%c %c", &t[i], &d[i]);
  }
}
void initialize() {
  for (size_t i = 0; i < N; i++) {
    int c = s[i] - 'A';
    target[c][target_num[c]] = i;
    target_num[c]++;
    panel[i] = 1;
  }
}
void shift_l(int c) {
  c -= 'A';
  for (int i = 0; i < target_num[c]; i++) {
    int n = target[c][i];
    if (0 < n) {
      panel[n - 1] += panel[n];
    }
    panel[n] = 0;
  }
}
void shift_r(int c) {
  c -= 'A';
  for (int i = target_num[c] - 1; i >= 0; i--) {
    int n = target[c][i];
    if (n < N - 1) {
      panel[n + 1] += panel[n];
    }
    panel[n] = 0;
  }
}
void cast_q(int n) {
  if (d[n] == 'L') {
    shift_l(t[n]);
  } else if (d[n] == 'R') {
    shift_r(t[n]);
  }
}
int count_golem() {
  int sum = 0;
  for (size_t i = 0; i < N; i++) {
    sum += panel[i];
  }
  return sum;
}
void print_panel() {
  for (size_t i = 0; i < N; i++) {
    printf("%d ", panel[i]);
  }
  printf("\n");
}
int main(void) {
  receive_input();
  initialize();
  for (size_t i = 0; i < Q; i++) {
    cast_q(i);
  }
  printf("%d\n", count_golem());
  return 0;
}
