#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long LLINF = 1LL << 60;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int i, n, j, q, k, move;
  string s;
  cin >> n >> q >> s;
  int ans = n;
  vector<vector<int> > v(26, vector<int>());
  char t[q], d[q];
  int num[n + 2];
  num[0] = 0;
  num[n + 1] = 0;
  for (i = 0; i < n; i++) {
    v[s[i] - 'A'].push_back(i);
    num[i + 1] = 1;
  }
  for (i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
    if (d[i] == 'L')
      move = -1;
    else
      move = 1;
    if (move < 0) {
      for (j = 0; j < v[t[i] - 'A'].size(); j++) {
        num[v[t[i] - 'A'][j]] += num[v[t[i] - 'A'][j] + 1];
        num[v[t[i] - 'A'][j] + 1] = 0;
      }
    } else {
      for (j = v[t[i] - 'A'].size() - 1; j >= 0; j--) {
        num[v[t[i] - 'A'][j] + 2] += num[v[t[i] - 'A'][j] + 1];
        num[v[t[i] - 'A'][j] + 1] = 0;
      }
    }
  }
  ans -= num[0] + num[n + 1];
  cout << ans << endl;
  return 0;
}
