#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> a(n + 2);
  for (int i = 1; i <= n; i++) {
    a[i] = 1;
  }
  vector<vector<int>> cnt(26);
  for (int i = 0; i < n; i++) {
    cnt[s[i] - 'A'].push_back(i + 1);
  }
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    for (int j : cnt[t - 'A']) {
      a[j + (d == 'L' ? -1 : 1)] += a[j];
      a[j] = 0;
    }
  }
  cout << n - a[0] - a[n + 1] << endl;
  return 0;
}
