#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<long long> state(N);
  for (long long j = 0; j < N; ++j) {
    state[j] = j + 1;
  }
  for (long long j = 0; j < Q; ++j) {
    char t, d;
    cin >> t >> d;
    long long idx = t - 'A';
    if (state[idx] != -1) {
      state[idx] += (d == 'L' ? -1 : 1);
      if (state[idx] < 1 || N < state[idx]) {
        state[idx] = -1;
      }
    }
  }
  long long ans = 0;
  for (long long j = 0; j < N; ++j) {
    if (state[j] != -1) {
      ans += 1;
    }
  }
  cout << ans << endl;
}
