#include <bits/stdc++.h>
int main(void) {
  int N, Q;
  char *s;
  int *g;
  int *alphabet[26], alphabet_num[26];
  int i, j;
  char t, d, c;
  int ctr, index;
  scanf("%d%c%d", &N, &c, &Q);
  s = (char *)malloc(sizeof(char) * (N + 1));
  g = (int *)malloc(sizeof(int) * N);
  for (i = 0; i < 26; i++) {
    alphabet[i] = (int *)malloc(sizeof(int) * N);
    alphabet_num[i] = 0;
  }
  ctr = N;
  scanf("%s\n", s);
  for (i = 0; i < N; i++) {
    g[i] = 1;
    switch (s[i]) {
      case 'A':
        alphabet[0][alphabet_num[0]++] = i;
        break;
      case 'B':
        alphabet[1][alphabet_num[1]++] = i;
        break;
      case 'C':
        alphabet[2][alphabet_num[2]++] = i;
        break;
      case 'D':
        alphabet[3][alphabet_num[3]++] = i;
        break;
      case 'E':
        alphabet[4][alphabet_num[4]++] = i;
        break;
      case 'F':
        alphabet[5][alphabet_num[5]++] = i;
        break;
      case 'G':
        alphabet[6][alphabet_num[6]++] = i;
        break;
      case 'H':
        alphabet[7][alphabet_num[7]++] = i;
        break;
      case 'I':
        alphabet[8][alphabet_num[8]++] = i;
        break;
      case 'J':
        alphabet[9][alphabet_num[9]++] = i;
        break;
      case 'K':
        alphabet[10][alphabet_num[10]++] = i;
        break;
      case 'L':
        alphabet[11][alphabet_num[11]++] = i;
        break;
      case 'M':
        alphabet[12][alphabet_num[12]++] = i;
        break;
      case 'N':
        alphabet[13][alphabet_num[13]++] = i;
        break;
      case 'O':
        alphabet[14][alphabet_num[14]++] = i;
        break;
      case 'P':
        alphabet[15][alphabet_num[15]++] = i;
        break;
      case 'Q':
        alphabet[16][alphabet_num[16]++] = i;
        break;
      case 'R':
        alphabet[17][alphabet_num[17]++] = i;
        break;
      case 'S':
        alphabet[18][alphabet_num[18]++] = i;
        break;
      case 'T':
        alphabet[19][alphabet_num[19]++] = i;
        break;
      case 'U':
        alphabet[20][alphabet_num[20]++] = i;
        break;
      case 'V':
        alphabet[21][alphabet_num[21]++] = i;
        break;
      case 'W':
        alphabet[22][alphabet_num[22]++] = i;
        break;
      case 'X':
        alphabet[23][alphabet_num[23]++] = i;
        break;
      case 'Y':
        alphabet[24][alphabet_num[24]++] = i;
        break;
      case 'Z':
        alphabet[25][alphabet_num[25]++] = i;
        break;
    }
  }
  for (i = 0; i < Q; i++) {
    scanf("%c%c%c%c", &t, &c, &d, &c);
    switch (t) {
      case 'A':
        index = 0;
        break;
      case 'B':
        index = 1;
        break;
      case 'C':
        index = 2;
        break;
      case 'D':
        index = 3;
        break;
      case 'E':
        index = 4;
        break;
      case 'F':
        index = 5;
        break;
      case 'G':
        index = 6;
        break;
      case 'H':
        index = 7;
        break;
      case 'I':
        index = 8;
        break;
      case 'J':
        index = 9;
        break;
      case 'K':
        index = 10;
        break;
      case 'L':
        index = 11;
        break;
      case 'M':
        index = 12;
        break;
      case 'N':
        index = 13;
        break;
      case 'O':
        index = 14;
        break;
      case 'P':
        index = 15;
        break;
      case 'Q':
        index = 16;
        break;
      case 'R':
        index = 17;
        break;
      case 'S':
        index = 18;
        break;
      case 'T':
        index = 19;
        break;
      case 'U':
        index = 20;
        break;
      case 'V':
        index = 21;
        break;
      case 'W':
        index = 22;
        break;
      case 'X':
        index = 23;
        break;
      case 'Y':
        index = 24;
        break;
      case 'Z':
        index = 25;
        break;
    }
    for (j = 0; j < alphabet_num[index]; j++) {
      if (g[alphabet[index][j]] > 0 && alphabet[index][j] >= 0 &&
          alphabet[index][j] < N) {
        if (d == 'L') {
          if (alphabet[index][j] > 0) {
            g[alphabet[index][j] - 1] += g[alphabet[index][j]];
          } else
            ctr -= g[alphabet[index][j]];
          g[alphabet[index][j]] = 0;
        } else {
          if (alphabet[index][j] < N - 1) {
            g[alphabet[index][j] + 1] += g[alphabet[index][j]];
          } else
            ctr -= g[alphabet[index][j]];
          g[alphabet[index][j]] = 0;
        }
      }
    }
  }
  printf("%d\n", ctr);
  free(s);
  free(g);
  for (i = 0; i < 26; i++) {
    free(alphabet[i]);
  }
  return 0;
}
