#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
int dx4[4] = {1, 0, -1, 0}, dy4[4] = {0, 1, 0, -1};
int main() {
  int n, q;
  string s;
  cin >> n >> q >> s;
  vector<char> t(q);
  vector<char> d(q);
  for (int i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  vector<int> mas[26], gorem(n);
  for (int i = 0; i < n; i++) {
    mas[s[i] - 'A'].push_back(i);
    gorem[i] = 1;
  }
  for (int qq = 0; qq < q; qq++) {
    int tt = t[qq] - 'A';
    char dd = d[qq];
    if (dd == 'L') {
      for (int poscnt = 0; poscnt < mas[tt].size(); poscnt++) {
        int pos = mas[tt][poscnt];
        if (pos > 0) {
          gorem[pos - 1] += gorem[pos];
        }
        gorem[pos] = 0;
      }
    } else {
      for (int poscnt = mas[tt].size() - 1; poscnt >= 0; poscnt--) {
        int pos = mas[tt][poscnt];
        if (pos < n - 1) {
          gorem[pos + 1] += gorem[pos];
        }
        gorem[pos] = 0;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += gorem[i];
  }
  cout << ans << endl;
  return 0;
}
