#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  int i = 1;
  cin >> N;
  cin >> Q;
  char iti[N];
  char siti[N];
  int goremu[N];
  char s;
  while (i <= N) {
    cin >> s;
    iti[i] = s;
    siti[i] = s;
    goremu[N] = i;
    i++;
  }
  int slide = 0;
  char num;
  char move;
  char L = 'L';
  char R = 'R';
  int kai = N;
  while (slide < Q) {
    cin >> num;
    cin >> move;
    slide++;
    i = 1;
    while (i <= N) {
      if (iti[i] == num) {
        if (move == L) {
          goremu[i] = goremu[i] + 1;
          iti[i] = siti[i + 1];
        } else if (move == R) {
          goremu[i] = goremu[i] - 1;
          iti[i] = siti[i - 1];
        }
      }
      if (goremu[i] == 0 || goremu[i] == N + 1) {
        kai--;
        iti[i] == 'Z';
      }
      i++;
    }
  }
  i = 1;
  cout << kai << endl;
}
