#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  char s[200010];
  int si[200010];
  pair<int, int> query[200010];
  scanf("%d%d", &n, &q);
  scanf("%s", s);
  for (int i = 0; i < n; i++) si[i] = s[i] - 'A';
  for (int i = 0; i < q; i++) {
    char t, d;
    scanf(" %c %c", &t, &d);
    query[i] = {t - 'A', d == 'L'};
  }
  reverse(query, query + q);
  bool visited[200010] = {};
  bool used[200010] = {};
  queue<int> qL[26], qR[26];
  qL[si[0]].push(0);
  qR[si[n - 1]].push(n - 1);
  for (int i = 0; i < q; i++) {
    int t = query[i].first;
    int d = query[i].second;
    vector<int> vec;
    if (d == 1) {
      while (qL[t].size()) {
        int p = qL[t].front();
        qL[t].pop();
        if (!visited[p]) {
          visited[p] = true;
          vec.push_back(p);
        }
      }
    } else {
      while (qR[t].size()) {
        int p = qR[t].front();
        qR[t].pop();
        if (!visited[p]) {
          visited[p] = true;
          vec.push_back(p);
        }
      }
    }
    for (int p : vec) {
      if (!used[p]) {
        used[p] = true;
        if (p > 0) qR[si[p - 1]].push(p - 1);
        if (p < n - 1) qL[si[p + 1]].push(p + 1);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += visited[i];
  }
  cout << n - ans << endl;
  return 0;
}
