#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, q, d, c[N];
char s[N];
vector<int> p[30];
int main() {
  cin >> n >> q;
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) p[s[i] - 'A'].push_back(i);
  for (int i = 1; i <= n; i++) c[i] = 1;
  for (int i = 1; i <= q; i++) {
    char si[10], di[10];
    scanf("%s%s", si, di);
    if (di[0] == 'L')
      d = -1;
    else
      d = 1;
    if (d == -1)
      for (int j = 0; j < p[si[0] - 'A'].size(); j++) {
        int x = p[si[0] - 'A'][j];
        c[x + d] += c[x];
        c[x] = 0;
      }
    if (d == 1)
      for (int j = p[si[0] - 'A'].size() - 1; j >= 0; j--) {
        int x = p[si[0] - 'A'][j];
        c[x + d] += c[x];
        c[x] = 0;
      }
    c[0] = c[n + 1] = 0;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += c[i];
  cout << ans << endl;
  return 0;
}
