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