#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int
main(void)
{
  int N;
  int Q;
  char *block;
  int *golem;
  
  scanf("%d%d", &N, &Q);
  block = malloc(N);
  golem = malloc(sizeof(int) * N);
  for (int i = 0; i < N; i++)
    golem[i] = 1;
 
  scanf("%s", block);
  scanf("%*c");
  
  while (Q-- > 0) {
    char ascii;
    char dir;
    
    scanf("%c %c%*c", &ascii, &dir);
    
    int *p;
    char *s;
    if (dir == 'R') {
      p = &golem[N-1];
      s = &block[N-1];
    } else {
      p = &golem[0];
      s = &block[0];
    }

    for (int i = 0; i < N; i++) {
      if (*s == ascii) {
        int tmp = *p;
        *p = 0;
        if (dir == 'R' && i < N - 1) {
          *(p + 1) += tmp;
        }
        if (dir == 'L' && 0 < i) {
          *(p - 1) += tmp;
      	}
      }

      if (dir == 'R') {
        p--;
        s--;
      } else {
        p++;
        s++;
      }
    }
  }
  
  int total = 0;
  for (int i = 0; i < N; i++) {
    total += golem[i];
  }
  
  printf("%d", total);
  
  return 0;
}