#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q, dir, aft;
  string c;
  cin >> N >> Q >> c;
  vector<int> G(N, 1);
  char t, d;
  int rem = N;
  for (int i = 0; i < Q; i++) {
    cin >> t >> d;
    if (d == 'L') {
      dir = -1;
      for (int j = 0; j < N; j++) {
        if (c[j] == t) {
          aft = j + dir;
          if (aft < 0 || aft >= N) {
            rem -= G[j];
            G[j] = 0;
          } else {
            G[aft] += G[j];
            G[j] = 0;
          }
        }
        if (rem == 0) break;
      }
    } else {
      dir = 1;
      for (int j = N - 1; j >= 0; j--) {
        if (c[j] == t) {
          aft = j + dir;
          if (aft < 0 || aft >= N) {
            rem -= G[j];
            G[j] = 0;
          } else {
            G[aft] += G[j];
            G[j] = 0;
          }
        }
        if (rem == 0) break;
      }
    }
    if (rem == 0) break;
  }
  cout << rem << endl;
}
