#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<ll, ll>;
constexpr ll INF = 1LL << 62;
int main(void) {
  ll N, Q;
  string S;
  cin >> N >> Q;
  cin >> S;
  vector<ll> num(N, 1);
  vector<vector<ll> > idxlst(26, vector<ll>());
  for (ll i = 0; i < N; i++) {
    idxlst[S[i] - 'A'].push_back(i);
  }
  for (ll i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    auto& il = idxlst[t - 'A'];
    if (d == 'L') {
      for (ll j = 0; j < il.size(); j++) {
        if (il[j] != 0) {
          num[il[j] - 1] += num[il[j]];
        }
        num[il[j]] = 0;
      }
    } else {
      for (ll j = il.size() - 1; j >= 0; j--) {
        if (il[j] != N - 1) {
          num[il[j] + 1] += num[il[j]];
        }
        num[il[j]] = 0;
      }
    }
  }
  cout << accumulate(num.begin(), num.end(), 0) << endl;
  return 0;
}
