#include <bits/stdc++.h>
using namespace std;
void compute(char s[], int count[], char t, char d, int N) {
  for (int i = 0; i < N; i++) {
    if (t == s[i]) {
      if ((i == 0 && d == 'L') || (i == N - 1 && d == 'R'))
        count[i] = 0;
      else {
        if (d == 'L') {
          count[i - 1] += count[i];
          count[i] = 0;
        } else {
          count[i + 1] += count[i];
          count[i] = 0;
        }
      }
    }
  }
  for (int i = 0; i < 8; i++) {
    cout << count[i];
  }
  cout << endl;
}
int main() {
  int N, M, sum = 0;
  int count[100010];
  char t, d;
  char s[100010];
  cin >> N >> M;
  getchar();
  cin.getline(s, N + 1);
  for (int i = 0; i < N; i++) {
    count[i] = 1;
  }
  for (int j = 0; j < M; j++) {
    cin >> t >> d;
    getchar();
    compute(s, count, t, d, N);
  }
  for (int i = 0; i < N; i++) {
    sum += count[i];
  }
  cout << sum << endl;
  return 0;
}
