#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  int count = 0;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector<char> place(Q);
  vector<char> instruction(Q);
  vector<int> golem(N);
  for (int i = 0; i < N; ++i) {
    golem.at(i) = i;
  }
  for (int j = 0; j < Q; ++j) {
    cin >> place.at(j);
    cin >> instruction.at(j);
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < Q; ++j) {
      if (S.at(i) == place.at(j)) {
        if (instruction.at(j) == 'L') {
          --golem.at(i);
          if (golem.at(i) < 0) {
            golem.at(i) = -2 * N;
          }
        } else if (instruction.at(j) == 'R') {
          ++golem.at(i);
          if (golem.at(i) >= N) {
            golem.at(i) = 2 * N;
          }
        }
      }
    }
  }
  for (int i = 0; i < N; i++) {
    if (golem.at(i) < 0 || golem.at(i) >= N) {
      count++;
    }
  }
  cout << N - count << endl;
}
