#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, q;
  string s;
  cin >> n >> q;
  cin >> s;
  char t[q];
  char d[q];
  int count[n];
  fill(count, count + n, 1);
  for (int i = 0; i < q; ++i) {
    cin >> t[i] >> d[i];
  }
  int outCount = 0;
  for (int i = 0; i < q; ++i) {
    char target = t[i];
    if (d[i] == 'L') {
      for (int j = 0; j < n; ++j) {
        if (s[j] == target) {
          if (j == 0) {
            outCount += count[j];
            count[j] = 0;
            continue;
          }
          int t = j - 1;
          count[t] = count[j] + count[t];
          count[j] = 0;
        }
      }
    } else {
      int n1 = n - 1;
      for (int j = n1; j >= 0; --j) {
        if (s[j] == target) {
          if (j == n1) {
            outCount += count[j];
            count[j] = 0;
            continue;
          }
          int t = j + 1;
          count[t] = count[j] + count[t];
          count[j] = 0;
        }
      }
    }
  }
  printf("%d\n", n - outCount);
}
int main() {
  solve();
  return 0;
};
