#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, q;
  string s;
  cin >> n >> q;
  cin >> s;
  char t[q];
  char d[q];
  int count[n];
  fill(count, count + n, 1);
  for (int i = 0; i < q; ++i) {
    cin >> t[i] >> d[i];
  }
  vector<vector<int>> iv = vector<vector<int>>(26, vector<int>());
  for (int k = 0; k < n; ++k) {
    iv[s[k] - 'A'].push_back(k);
  }
  int outCount = 0;
  for (int i = 0; i < q; ++i) {
    char target = t[i];
    auto indexies = iv[target - 'A'];
    if (d[i] == 'L') {
      for (int j = 0; j < indexies.size(); ++j) {
        if (indexies[j] == -1) continue;
        if (indexies[j] == 0) {
          outCount += count[indexies[j]];
          count[indexies[j]] = 0;
          continue;
        }
        int t = indexies[j] - 1;
        count[t] = count[indexies[j]] + count[t];
        count[indexies[j]] = 0;
      }
    } else {
      for (int j = 0; j < indexies.size(); ++j) {
        if (indexies[j] == -1) continue;
        if (indexies[j] == (n - 1)) {
          outCount += count[indexies[j]];
          count[indexies[j]] = 0;
          continue;
        }
        int t = indexies[j] + 1;
        count[t] = count[indexies[j]] + count[t];
        count[indexies[j]] = 0;
      }
    }
  }
  printf("%d\n", n - outCount);
}
int main() {
  solve();
  return 0;
};
