#include <bits/stdc++.h>
using namespace std;
void down(const string str, const int size, const char c, vector<int>& vec) {
  for (int i = 1; i < size; i++) {
    if (c == str.at(i)) {
      vec.at(i - 1) += vec.at(i);
      vec.at(i) = 0;
    }
  }
}
void up(const string str, const int size, const char c, vector<int>& vec) {
  for (int i = size - 1; i > 0; i--) {
    if (c == str.at(i - 1)) {
      vec.at(i) += vec.at(i - 1);
      vec.at(i - 1) = 0;
    }
  }
}
int main() {
  int N;
  int Q;
  string s;
  cin >> N >> Q >> s;
  vector<char> t(Q);
  vector<char> d(Q);
  vector<int> numg(N);
  for (int i = 0; i < Q; i++) {
    cin >> t.at(i) >> d.at(i);
  }
  for (int i = 0; i < N; i++) {
    numg.at(i) = 1;
  }
  int num = 0;
  char tt;
  for (int i = 0; i < Q; i++) {
    tt = t.at(i);
    if (d.at(i) == 'L') {
      if (tt == s.at(0)) {
        num += numg.at(0);
        numg.at(0) = 0;
        down(s, N, tt, numg);
      } else {
        down(s, N, tt, numg);
      }
    } else if (d.at(i) == 'R') {
      if (tt == s.at(N - 1)) {
        num += numg.at(N - 1);
        numg.at(N - 1) = 0;
        up(s, N, tt, numg);
      } else {
        up(s, N, tt, numg);
      }
    }
  }
  cout << N - num << endl;
}
