#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long N, Q;
char c[200010];
char t[200010], d[200010];
vector<long long> cnt[30];
long long P[200010];
void solve() {
  for (long long i = 1; i <= N; i++) {
    P[i]++;
  }
  for (long long i = 0; i < N; i++) {
    cnt[c[i] - 'A'].push_back(i + 1);
  }
  for (long long i = 0; i < Q; i++) {
    long long I = t[i] - 'A';
    if (d[i] == 'L') {
      for (long long j = 0; j < (long long)cnt[I].size(); j++) {
        P[cnt[I][j] - 1] += P[cnt[I][j]];
        P[cnt[I][j]] = 0;
      }
    }
    if (d[i] == 'R') {
      for (long long j = (long long)cnt[I].size() - 1; j >= 0; j--) {
        P[cnt[I][j] + 1] += P[cnt[I][j]];
        P[cnt[I][j]] = 0;
      }
    }
  }
  cout << N - P[0] - P[N + 1] << endl;
}
signed main() {
  cin >> N >> Q;
  for (long long i = 0; i < N; i++) {
    cin >> c[i];
  }
  for (long long i = 0; i < Q; i++) {
    cin >> t[i];
    cin >> d[i];
  }
  solve();
  return 0;
}
