#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q, i, b = 0, r = 0, ans = 0;
  ;
  string str;
  vector<int> vec[26], vec_num(200000, 0);
  cin >> N >> Q >> str;
  for (i = 0; i < (N); ++i) vec[str[i] - 'A'].push_back(i);
  for (i = 0; i < (N); ++i) vec_num[i] = 1;
  char t, d;
  for (i = 0; i < (Q); ++i) {
    cin >> t >> d;
    if (d == 'R') {
      for (int j = 0; j < (int)vec[t - 'A'].size(); j++) {
        if (vec[t - 'A'][j] == (N - 1))
          ans += vec_num[vec[t - 'A'][j]];
        else
          vec_num[vec[t - 'A'][j] + 1] += vec_num[vec[t - 'A'][j]];
        vec_num[vec[t - 'A'][j]] = 0;
      }
    } else {
      for (int j = 0; j < (int)vec[t - 'A'].size(); j++) {
        if (vec[t - 'A'][j] == 0)
          ans += vec_num[vec[t - 'A'][j]];
        else
          vec_num[vec[t - 'A'][j] - 1] += vec_num[vec[t - 'A'][j]];
        vec_num[vec[t - 'A'][j]] = 0;
      }
    }
  }
  cout << N - ans << endl;
  return 0;
}
