#include <bits/stdc++.h>
using namespace std;
long long N, Q;
long long s[500000];
vector<long long> pos[100];
long long isout[500000];
signed main() {
  cin >> N >> Q;
  pair<long long, long long> shoukan[2];
  string str;
  cin >> str;
  for (long long(i) = 0; (i) < (N); (i)++) {
    s[i] = str[i] - 'A';
    pos[s[i]].push_back(i);
  }
  shoukan[0] = {s[N - 1], 1};
  shoukan[1] = {s[0], -1};
  vector<pair<long long, long long> > query;
  for (long long(i) = 0; (i) < (Q); (i)++) {
    char a, b;
    cin >> a >> b;
    query.push_back({a - 'A', b == 'L' ? -1 : 1});
  }
  vector<long long> search;
  search.push_back(0);
  search.push_back(N - 1);
  for (long long(tmp) = 0; (tmp) < (Q); (tmp)++) {
    long long i = Q - tmp - 1;
    pair<long long, long long> q = query[i];
    long long size = search.size();
    for (long long(i) = 0; (i) < (size); (i)++) {
      long long c = search[i];
      if (c + q.second == -1) {
        isout[c] = 1;
        search.push_back(c + 1);
      } else if (c + q.second == N) {
        isout[c] = 1;
        search.push_back(c - 1);
      } else if (isout[c + q.second]) {
        isout[c] = 1;
        search.push_back(c + 1);
        search.push_back(c - 1);
      } else {
        isout[c] = 0;
        search.push_back(c + 1);
        search.push_back(c - 1);
      }
    }
    search.erase(search.begin(), search.begin() + size);
  }
  long long ans = 0;
  for (long long(i) = 0; (i) < (N); (i)++) {
    ans += isout[i];
  }
  cout << N - ans << endl;
  return 0;
}
