#include <bits/stdc++.h>
using namespace std;
struct node2 {
  int x;
  char y;
} xx[200010];
int n, m;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    cin >> xx[i].y;
    xx[i].x = 1;
  }
  char a, b;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    for (int j = 0; j < n; j++) {
      if (b == 'R') {
        int v = n - 1 - j;
        if (xx[v].y == a) {
          if (v == (n - 1)) {
            xx[v].x = 0;
            continue;
          }
          xx[v + 1].x += xx[v].x;
          xx[v].x = 0;
        }
      } else if (b == 'L') {
        if (xx[j].y == a) {
          if (j == 0) {
            xx[i].x = 0;
            continue;
          }
          xx[j - 1].x += xx[j].x;
          xx[j].x = 0;
        }
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += xx[i].x;
  }
  printf("%d\n", sum);
  return 0;
}
