#include <bits/stdc++.h>
void shift(int *room, int N, int j, char d) {
  if ((j == 0 && d == 'L') || (j == N - 1 && d == 'R')) {
    room[j] = 0;
  } else {
    if (d == 'L') {
      room[j - 1] += room[j];
      room[j] = 0;
    } else if (d == 'R') {
      room[j + 1] += room[j];
      room[j] = 0;
    }
  }
}
int main(void) {
  int N, Q, sum = 0;
  int room[200000];
  char t, d;
  char s[200000];
  scanf("%d %d\n%s\n", &N, &Q, s);
  for (int i = 0; i < N; i++) {
    room[i] = 1;
  }
  for (int i = 0; i < Q; i++) {
    scanf("%c %c", &t, &d);
    if (i != Q - 1) {
      scanf("\n");
    }
    if (d == 'L') {
      for (int j = 0; j < N; j++) {
        if (t == s[j]) {
          shift(room, N, j, d);
        }
      }
    } else if (d == 'R') {
      for (int j = N - 1; j >= 0; j--) {
        if (t == s[j]) {
          shift(room, N, j, d);
        }
      }
    }
  }
  for (int i = 0; i < N; i++) {
    sum += room[i];
  }
  printf("%d\n", sum);
  return 0;
}
