#include <bits/stdc++.h>
int main() {
  int N, Q;
  std::string S;
  char t, d;
  std::cin >> N >> Q >> S;
  int golem[200002];
  golem[0] = 0;
  golem[N + 1] = 0;
  for (int n = 1; n <= N; ++n) {
    golem[n] = 1;
  }
  std::map<char, std::vector<int>> pos;
  for (int n = 1; n <= N; ++n) {
    pos[S.at(n - 1)].push_back(n);
  }
  for (int q = 1; q <= Q; ++q) {
    std::cin >> t >> d;
    std::vector<int> v = pos[t];
    if (d == 'L') {
      for (std::vector<int>::iterator n = v.begin(); n != v.end(); ++n) {
        golem[*n - 1] += golem[*n];
        golem[*n] = 0;
      }
    } else {
      for (std::vector<int>::reverse_iterator n = v.rbegin(); n != v.rend();
           ++n) {
        golem[*n + 1] += golem[*n];
        golem[*n] = 0;
      }
    }
  }
  std::cout << N - golem[0] - golem[N + 1] << "\n";
  return 0;
}
