#include <bits/stdc++.h>
void move_golems_right(int *golems, char *cells, int N, char target);
void move_golems_left(int *golems, char *cells, int N, char target);
int main(void) {
  int N, Q;
  scanf("%d %d", &N, &Q);
  char s[N];
  scanf("%s", s);
  int golems[N];
  for (int i = 0; i < N; i++) {
    golems[i] = 1;
  }
  for (int i = 0; i < Q; i++) {
    char t, d;
    scanf("%s %s", &t, &d);
    if (d == 'R') {
      move_golems_right(golems, s, N, t);
    } else {
      move_golems_left(golems, s, N, t);
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++) {
    sum += golems[i];
  }
  printf("%d\n", sum);
  return 0;
}
void move_golems_right(int *golems, char *cells, int N, char target) {
  int increase_cells[N];
  for (int i = 0; i < N; i++) {
    increase_cells[i] = 0;
  }
  for (int i = 0; i < N; i++) {
    if (cells[i] == target) {
      if (i != N - 1) {
        increase_cells[i + 1] = golems[i];
      }
      golems[i] = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    golems[i] += increase_cells[i];
  }
}
void move_golems_left(int *golems, char *cells, int N, char target) {
  int increase_cells[N];
  for (int i = 0; i < N; i++) {
    increase_cells[i] = 0;
  }
  for (int i = 0; i < N; i++) {
    if (cells[i] == target) {
      if (i != 0) {
        increase_cells[i - 1] = golems[i];
      }
      golems[i] = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    golems[i] += increase_cells[i];
  }
}
