#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<int> cnt(n + 2, 1);
  cnt[0] = 0;
  cnt[n + 1] = 0;
  map<char, vector<int>> alpha;
  for (int i = 0; i < n; i++) {
    alpha[s[i]].push_back(i);
  }
  vector<char> t(q), d(q);
  for (int i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
    if (d[i] == 'L') {
      for (int j : alpha[t[i]]) {
        cnt[j] += cnt[j + 1];
        cnt[j + 1] = 0;
      }
    }
    if (d[i] == 'R') {
      for (int j : alpha[t[i]]) {
        cnt[j + 2] += cnt[j + 1];
        cnt[j + 1] = 0;
      }
    }
    cnt[0] = 0;
    cnt[n + 1] = 0;
  }
  int ans = 0;
  for (int i = 1; i < n + 1; i++) {
    ans += cnt[i];
  }
  cout << ans << endl;
}
