#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  char t[n], d[n];
  vector<int> v[26], cnt(n, 1);
  for (int i = 0; i < n; i++) {
    v[s[i] - 'A'].push_back(i);
  }
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  int sum = 0;
  for (int i = 0; i < q; i++) {
    int idx = t[i] - 'A';
    for (int j = 0; j < v[idx].size(); j++) {
      int cur = v[idx][j];
      if (d[i] == 'R') {
        if (cur + 1 == n) {
          sum += cnt[cur];
          cnt[cur] = 0;
        } else {
          cnt[cur + 1] += cnt[cur];
          cnt[cur] = 0;
        }
      } else {
        if (cur - 1 == -1) {
          sum += cnt[cur];
          cnt[cur] = 0;
        } else {
          cnt[cur - 1] += cnt[cur];
          cnt[cur] = 0;
        }
      }
    }
  }
  cout << n - sum << endl;
  return 0;
}
