#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  char s[210000], t[210000], d[210000];
  for (int i = 0; i < N; i++) cin >> s[i];
  for (int i = 0; i < Q; i++) cin >> t[i] >> d[i];
  int num[210000];
  for (int i = 0; i < N; i++) num[i] = i + 1;
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < N; j++) {
      if (s[j] == t[i]) {
        if (d[i] == 'L') num[j] -= 1;
        if (d[i] == 'R') num[j] += 1;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (1 <= num[i] && num[i] < N) ans++;
  }
  cout << ans << endl;
}
