#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  char *t = new char[Q];
  char *d = new char[Q];
  int *golem = new int[N];
  int golemcounter = 0;
  for (int h = 0; h < N; h++) {
    golem[h] = 1;
  }
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
    for (int j = 0; j < N; j++) {
      if (s.at(0) == t[i] && d[i] == 'L') {
        golemcounter += golem[0];
        golem[0] = 0;
      } else if (s.at(N - 1) == t[i] && d[i] == 'R') {
        golemcounter += golem[N - 1];
        golem[N - 1] = 0;
      } else if (s.at(j) == t[i] && d[i] == 'L') {
        golem[j - 1] += golem[j];
        golem[j] = 0;
      } else if (s.at(j) == t[i] && d[i] == 'R') {
        golem[j + 1] += golem[j];
        golem[j] = 0;
      }
    }
  }
  delete[] t;
  delete[] d;
  delete[] golem;
  cout << N - golemcounter << "\n";
}
