#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma warning(disable : 4996)
using namespace std;
char S[200005];
char t[200005][2], d[200005][2];
queue<int> Q[26][2];
int mark[200005];
void solve(int ks) {
  int n, q;
  scanf("%d %d", &n, &q);
  scanf("%s", S);
  for (int i = 1; i <= q; i++) {
    scanf("%s %s", t[i], d[i]);
  }
  Q[S[0] - 'A'][0].push(0);
  Q[S[n - 1] - 'A'][1].push(n - 1);
  for (int i = q; i >= 1; i--) {
    int pos = t[i][0] - 'A';
    int dir = d[i][0] == 'R';
    vector<int> V;
    while (!Q[pos][dir].empty()) {
      int u = Q[pos][dir].front();
      V.push_back(u);
      Q[pos][dir].pop();
    }
    for (int u : V) {
      if (mark[u]) continue;
      mark[u] = 1;
      if (u - 1 >= 0 && mark[u - 1] == 0) {
        Q[S[u - 1] - 'A'][1].push(u - 1);
      }
      if (u + 1 < n && mark[u + 1] == 0) {
        Q[S[u + 1] - 'A'][0].push(u + 1);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += mark[i] == 0;
  }
  printf("%d\n", ans);
}
int main() {
  if (0) {
    int T = 1000;
    scanf("%d", &T);
    for (int ks = 1; ks <= T; ks++) solve(ks);
  } else {
    solve(0);
  }
  return 0;
}
