#include <bits/stdc++.h>
int max(int a, int b) { return (a > b ? a : b); }
int min(int a, int b) { return (a < b ? a : b); }
int compare_int(const void *a, const void *b) { return *(int *)a - *(int *)b; }
double BS(int array[], int len, int target);
int N, Q;
char b;
int main() {
  scanf("%d%d", &N, &Q);
  scanf("%c", &b);
  char s[N + 2];
  int m[N + 2];
  for (int i = 0; i < N + 2; i++) {
    m[i] = 1;
  }
  char t[Q], d[Q];
  for (int i = 1; i < N + 1; i++) {
    scanf("%c", &s[i]);
  }
  scanf("%c", &b);
  for (int i = 0; i < Q; i++) {
    scanf("%c %c%c", &t[i], &d[i], &b);
  }
  for (int i = 0; i < Q; i++) {
    if (d[i] == 'L') {
      for (int j = 1; j < N + 1; j++) {
        if (s[j] == t[i]) {
          m[j - 1] += m[j];
          m[j] = 0;
        }
      }
    }
    if (d[i] == 'R') {
      for (int j = 1; j < N + 1; j++) {
        if (s[j] == t[i]) {
          m[j + 1] += m[j];
          m[j] = 0;
        }
      }
    }
  }
  int count = 0;
  for (int i = 1; i < N + 1; i++) {
    count += m[i];
  }
  printf("%d\n", count);
  return 0;
}
double BS(int array[], int len, int target) {
  int low, mid, high;
  low = 0;
  high = len - 1;
  int mark;
  while (low <= high) {
    mid = (low + high) / 2;
    if (array[mid] == target) {
      mark = 0;
      break;
    } else if (array[mid] < target) {
      low = mid + 1;
      mark = 1;
    } else {
      high = mid - 1;
      mark = -1;
    }
  }
  if (mark == 0) {
    return mid;
  } else if (mark == 1) {
    return (double)mid + 0.5;
  } else {
    return (double)mid - 0.5;
  }
}
