#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
vector<vector<long long> > al(26);
int main() {
  long long N, Q;
  string s;
  cin >> N >> Q >> s;
  for (long long(i) = (0); (i) < (N); ++(i)) {
    al[s[i] - 'A'].push_back(i + 1);
  }
  vector<long long> num(N + 2);
  for (long long i = 1; i <= N; i++) num[i] = 1;
  num[0] = num[N + 1] = 0;
  for (long long i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'R') {
      for (long long j = al[t - 'A'].size() - 1; j >= 0; j--) {
        long long tmp = num[al[t - 'A'][j]];
        num[al[t - 'A'][j] + 1] += tmp;
        num[al[t - 'A'][j]] = 0;
        if (num[27] > 0) {
          num[27] = 0;
        }
      }
    } else {
      for (long long j = 0; j < al[t - 'A'].size(); j++) {
        long long tmp = num[al[t - 'A'][j]];
        num[al[t - 'A'][j] - 1] += tmp;
        num[al[t - 'A'][j]] = 0;
        if (num[0] > 0) {
          num[0] = 0;
        }
      }
    }
  }
  long long cnt = 0;
  for (long long i = 1; i <= N; i++) {
    cnt += num[i];
  }
  cout << cnt << endl;
}
