#include <bits/stdc++.h>
int MEMO_IX[26];
int MEMO[26][200000];
char s[200000 + 1];
char t[200000];
char d[200000];
int robo[200000 + 2];
void print_robo(int N) {
  for (int j = 0; j < N + 2; j++) {
    printf("%d,", robo[j]);
  }
  printf("\n");
}
int main() {
  int N, Q;
  scanf("%d %d\n", &N, &Q);
  scanf("%s\n", s);
  for (int i = 0; i < Q; i++) {
    char t_, d_;
    scanf("%c %c\n", &t_, &d_);
    t[i] = t_;
    d[i] = d_;
  }
  for (int i = 1; i <= N; i++) {
    robo[i] = 1;
  }
  for (int i = 0; i < N; i++) {
    char c = s[i];
    int cix = c - 'A';
    MEMO[cix][MEMO_IX[cix]++] = i + 1;
  }
  for (int i = 0; i < Q; i++) {
    int cix = t[i] - 'A';
    if (d[i] == 'L') {
      for (int j = 0; j < MEMO_IX[cix]; j++) {
        int ix2 = MEMO[cix][j];
        robo[ix2 - 1] += robo[ix2];
        robo[ix2] = 0;
      }
    } else if (d[i] == 'R') {
      for (int j = MEMO_IX[cix] - 1; j >= 0; j--) {
        int ix2 = MEMO[cix][j];
        robo[ix2 + 1] += robo[ix2];
        robo[ix2] = 0;
      }
    } else {
      printf("Unknown %c\n", d[i]);
    }
  }
  printf("%d\n", N - robo[0] - robo[N + 1]);
}
