#include <bits/stdc++.h>
typedef struct {
  int index;
  int num;
} instance;
static instance area1[200000];
static instance area2[200000];
static int n;
static char s[200000 + 2];
static instance *current_area;
static instance *temp_area;
static int area_cnt;
static void init_area() {
  for (int i = 0; i < n; i++) {
    area1[i].index = i;
    area1[i].num = 1;
  }
  current_area = area1;
  area_cnt = n;
  temp_area = area2;
}
static void move_left(char t) {
  int j = -1;
  for (int i = 0; i < area_cnt; i++) {
    if (s[current_area[i].index] == t) {
      current_area[i].index--;
      if (current_area[i].index < 0) {
        continue;
      }
      if (j >= 0 && current_area[i].index == temp_area[j].index) {
        temp_area[j].num += current_area[i].num;
        continue;
      }
    }
    temp_area[++j] = current_area[i];
  }
  area_cnt = j + 1;
  instance *tmp = temp_area;
  temp_area = current_area;
  current_area = tmp;
}
static void move_right(char t) {
  int j = area_cnt;
  for (int i = area_cnt - 1; i >= 0; i--) {
    if (s[current_area[i].index] == t) {
      current_area[i].index++;
      if (current_area[i].index >= n) {
        continue;
      }
      if (j < area_cnt && current_area[i].index == temp_area[j].index) {
        temp_area[j].num += current_area[i].num;
        continue;
      }
    }
    temp_area[--j] = current_area[i];
  }
  area_cnt = area_cnt - j;
  instance *tmp = temp_area + j;
  temp_area = current_area;
  current_area = tmp;
}
static int get_answer() {
  int ans = 0;
  for (int i = 0; i < area_cnt; i++) {
    ans += current_area[i].num;
  }
  return ans;
}
int main() {
  int q;
  scanf("%d%d", &n, &q);
  scanf("%s", s);
  init_area();
  for (int i = 0; i < q; i++) {
    char t, d;
    scanf(" %c %c", &t, &d);
    if (d == 'L') {
      move_left(t);
    } else if (d == 'R') {
      move_right(t);
    } else {
      return 1;
    }
  }
  int ans = get_answer();
  printf("%d\n", ans);
}
