#include <bits/stdc++.h>
using namespace std;
struct miria {
  bool isOk;
  int index;
  char moji;
};
vector<miria> yuri;
int main() {
  int N, Q;
  int dame = 0;
  string s;
  cin >> N >> Q;
  cin >> s;
  for (int i = 0; i < N; i++) {
    yuri.push_back(miria{true, i + 1, s[i]});
  }
  for (int i = 0; i < Q; i++) {
    char ritsu;
    char aka;
    cin >> ritsu >> aka;
    for (int j = 0; j < N; j++) {
      if (!yuri[j].isOk) {
        continue;
      }
      if (yuri[j].moji == ritsu) {
        if (aka == 'L') {
          yuri[j].index--;
          if (yuri[j].index >= 1) {
            yuri[j].moji = s[yuri[j].index - 1];
          } else {
            yuri[j].isOk = false;
            dame++;
          }
        } else {
          yuri[j].index++;
          if (yuri[j].index <= N) {
            yuri[j].moji = s[yuri[j].index - 1];
          } else {
            yuri[j].isOk = false;
            dame++;
          }
        }
      }
    }
  }
  cout << N - dame << endl;
  return 0;
}
