#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5;
const int inf = 0x3f3f3f3f;
int n, m;
long long ans, tot;
struct Node {
  char s;
  int id;
} eage[maxn + 7];
char ch1, ch2;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> eage[i].s;
    eage[i].id = i;
  }
  for (int i = 1; i <= m; i++) {
    cin >> ch1 >> ch2;
    for (int i = 1; i <= n; i++) {
      if (eage[i].s == ch1) {
        if (ch2 == 'R') {
          eage[i].id++;
          if (eage[i].id > n) {
            for (int j = 1; j <= n; j++)
              if (eage[j].s == ch1) eage[j].s = '+';
          }
        } else {
          eage[i].id--;
          if (eage[i].id < 1) {
            for (int j = 1; j <= n; j++)
              if (eage[j].s == ch1) eage[j].s = '+';
          }
        }
      }
    }
  }
  for (int i = 1; i <= n; i++)
    if (eage[i].s != '+') tot++;
  printf("%lld\n", tot);
  return 0;
}
