#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q, cou;
  int go[200002];
  char s[200002];
  cin >> n >> q >> s;
  for (int i = 0; i < n; i++) go[i] = 1;
  cou = 0;
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      if (s[0] == t) {
        cou += go[0];
        go[0] = 0;
      }
      for (int j = 1; j < n; j++) {
        if (s[j] == t) {
          go[j - 1] += go[j];
          go[j] = 0;
        }
      }
    }
    if (d == 'R') {
      if (s[n - 1] == t) {
        cou += go[n - 1];
        go[n - 1] = 0;
      }
      for (int j = 0; j < n - 1; j++) {
        if (s[j] == t) {
          go[j + 1] += go[j];
          go[j] = 0;
        }
      }
    }
  }
  cout << n - cou << endl;
  return 0;
}
