#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  int f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -f;
  for (; isdigit(c); c = getchar()) x = x * 10 + (c - '0');
  return x * f;
}
vector<int> a[30];
int now[101010];
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  for (int i = (int)0; i < (int)n; i++) now[i] = 1;
  char c, ch;
  for (int i = (int)0; i < (int)n; i++) a[s[i] - 'A'].push_back(i);
  for (int i = (int)0; i < (int)n; i++) now[i] = 1;
  for (int i = (int)0; i < (int)q; i++) {
    cin >> c >> ch;
    for (int j = (int)0; j < (int)a[c - 'A'].size(); j++) {
      int x = a[c - 'A'][j];
      if (ch == 'L' && x > 0) now[x - 1] += now[x];
      if (ch == 'R' && x < n - 1) now[x + 1] += now[x];
      now[x] = 0;
    }
  }
  int ans = 0;
  for (int i = (int)0; i < (int)n; i++) ans += now[i];
  cout << ans << endl;
  return 0;
}
