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