#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  vector<char> s(n);
  vector<vector<int> > a(26);
  for (int i = 0; i < (n); ++i) {
    cin >> s[i];
    a[s[i] - 'A'].push_back(i);
  }
  vector<int> b(n, 1);
  int ans = n;
  for (int i = 0; i < (q); ++i) {
    char c;
    char l;
    cin >> c >> l;
    if (a[c - 'A'].size() == 0) continue;
    if (l == 'L') {
      for (int j = 0; j < (a[c - 'A'].size()); ++j) {
        if (a[c - 'A'][j] == 0) {
          ans -= b[0];
          b[0] = 0;
        } else {
          b[a[c - 'A'][j] - 1] += b[a[c - 'A'][j]];
          b[a[c - 'A'][j]] = 0;
        }
      }
    } else {
      for (int j = a[c - 'A'].size() - 1; j >= 0; --j) {
        if (a[c - 'A'][j] == n - 1) {
          ans -= b[n - 1];
          b[n - 1] = 0;
        } else {
          b[a[c - 'A'][j] + 1] += b[a[c - 'A'][j]];
          b[a[c - 'A'][j]] = 0;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
