#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  cin >> n >> q;
  cin >> s;
  char t[q], d[q];
  for (int i = 0; i < q; i++) cin >> t[i] >> d[i];
  vector<pair<char, int>> v(n);
  for (int i = 0; i < n; i++) v[i] = (make_pair(s[i], 1));
  for (int i = 0; i < q; i++) {
    if (d[i] == 'R') {
      for (int j = 0; j < n - 1; j++) {
        if ((v[j].first) == (t[i])) {
          v[j + 1].second += v[j].second;
          v[j].second = 0;
        }
      }
      if (v[n - 1].first == t[i]) v[n - 1].second = 0;
    } else {
      if (v[0].first == t[i]) v[0].second = 0;
      for (int k = 1; k < n; k++) {
        if (v[k].first == t[i]) {
          v[k - 1].second += v[k].second;
          v[k].second = 0;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans += v[i].second;
  cout << ans << endl;
  return 0;
}
