#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  vector<char> T(Q);
  vector<long long> D(Q);
  char c;
  for (long long i = 0; i < Q; i++) {
    cin >> T[i] >> c;
    if (c == 'L') {
      D[i] = 0;
    } else {
      D[i] = 1;
    }
  }
  vector<vector<vector<long long> > > X(27, vector<vector<long long> >(2));
  vector<long long> dp(N + 2, 0);
  dp[0] = 1;
  dp[N + 1] = 1;
  X[S[0] - 'A'][0].push_back(1);
  X[S[N - 1] - 'A'][1].push_back(N);
  for (long long i = Q - 1; i >= 0; i--) {
    for (long long j : X[T[i] - 'A'][D[i]]) {
      if (dp[j] == 0) {
        dp[j] = 1;
        if (dp[j + 1] == 0) {
          X[S[j + 1 - 1] - 'A'][0].push_back(j + 1);
        } else if (dp[j - 1] == 0) {
          X[S[j - 1 - 1] - 'A'][1].push_back(j - 1);
        }
      }
    }
    X[T[i] - 'A'][D[i]].clear();
  }
  long long res = 0;
  for (long long i = 1; i <= N; i++) {
    if (dp[i] == 0) res++;
  }
  cout << res << endl;
}
