#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  char t, d;
  vector<vector<int>> block_info(26);
  vector<int> gorem(N);
  for (int i = (0); i < (N); i++) {
    block_info[s[i] - 65].push_back(i);
    gorem[i] = 1;
  }
  for (int i = (0); i < (Q); i++) {
    cin >> t >> d;
    for (int pos : block_info[t - 65]) {
      if (gorem[pos] == 0) {
        continue;
      }
      if ((pos == 0 && d == 'L') || pos == N - 1 && d == 'R') {
        gorem[pos] = 0;
      } else if (d == 'L') {
        gorem[pos - 1] += gorem[pos];
        gorem[pos] = 0;
      } else {
        gorem[pos + 1] += gorem[pos];
        gorem[pos] = 0;
      }
    }
  }
  int sum = 0;
  for (int i = (0); i < (N); i++) {
    sum += gorem[i];
  }
  cout << sum << endl;
  return 0;
}
