#include <bits/stdc++.h>
int main(void) {
  int i;
  int j;
  int N;
  char* s;
  int Q;
  char* t;
  char* d;
  scanf("%d %d", &N, &Q);
  s = (char*)malloc(sizeof(char) * N);
  t = (char*)malloc(sizeof(char) * Q);
  d = (char*)malloc(sizeof(char) * Q);
  scanf("%s", s);
  int* G;
  G = (int*)malloc(sizeof(int) * N);
  for (i = 0; i < N; i++) {
    G[i] = 1;
  }
  int count;
  count = N;
  for (i = 0; i < Q; i++) {
    scanf("\n%c %c ", &d[i], &t[i]);
    if (t[i] == 'L') {
      for (j = 0; j < N; j++) {
        if (s[j] == d[i]) {
          if (j == 0) {
            count -= G[0];
          } else {
            G[j - 1] += G[j];
          }
          G[j] = 0;
        }
      }
    } else {
      for (j = 0; j < N; j++) {
        if (s[j] == d[i]) {
          if (j == N - 1) {
            count -= G[N - 1];
          } else {
            G[j + 1] += G[j];
          }
          G[j] = 0;
        }
      }
    }
  }
  printf("%d", count);
}
