#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
void cmax(T& a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
void cmin(T& a, U b) {
  if (a > b) a = b;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, Q;
  string S;
  cin >> N >> Q >> S;
  vector<char> T(Q), D(Q);
  for (long long i = 0; i < Q; i++) cin >> T[i] >> D[i];
  vector<int> index[26];
  for (long long i = 0; i < N; i++) {
    index[S[i] - 'A'].push_back(i);
  }
  vector<int> field(N, 1);
  int ans = N;
  for (long long i = 0; i < Q; i++) {
    const vector<int>& vec = index[T[i] - 'A'];
    int diff, start, end;
    if (D[i] == 'R') {
      diff = 1, start = vec.size() - 1, end = -1;
    } else {
      diff = -1, start = 0, end = vec.size();
    }
    for (int j = start; j != end; j -= diff) {
      int k = vec[j];
      if (k + diff < 0 || N <= k + diff) {
        ans -= field[k];
      } else {
        field[k + diff] += field[k];
      }
      field[k] = 0;
    }
  }
  cout << ans << endl;
}
