#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q, count = 0;
  string S;
  char t, d;
  int G[200000];
  bool P[200000];
  cin >> N >> Q >> S;
  for (int i = 0; i < N; i++) {
    G[i] = i;
    P[i] = true;
  }
  count = N;
  for (int i = 0; i < Q; i++) {
    cin >> t >> d;
    int move;
    if (d == 'R')
      move = 1;
    else
      move = -1;
    for (int j = 0; j < N; j++) {
      if (S[G[j]] == t && P[j]) {
        G[j] += move;
        if (G[j] == -1 || G[j] == N) P[j] = false, G[j] = 0, count--;
      }
    }
  }
  cout << count;
}
