#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, Q, result = 0;
  cin >> N >> Q;
  char s[N];
  cin >> s;
  std::vector<char> t(Q), d(Q);
  vector<long long> num(N + 2, 1);
  num[0] = 0;
  num[N + 1] = 0;
  vector<vector<char> > v(26);
  for (long long i = 0; i < N; i++) {
    v[s[i] - 'A'].push_back(i + 1);
  }
  for (long long i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  for (long long i = 0; i < Q; i++) {
    char moji = t[i] - 'A';
    if (d[i] == 'R') {
      for (long long j = 0; j < v[moji].size(); j++) {
        num[v[moji][j] + 1] += num[v[moji][j]];
        num[v[moji][j]] = 0;
      }
    } else {
      for (long long j = 0; j < v[moji].size(); j++) {
        num[v[moji][j] - 1] += num[v[moji][j]];
        num[v[moji][j]] = 0;
      }
    }
  }
  result = N - num[0] - num[N + 1];
  cout << result << endl;
}
