#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
template <class T, class C>
void chmax(T& a, C b) {
  a > b ?: a = b;
}
template <class T, class C>
void chmin(T& a, C b) {
  a < b ?: a = b;
}
int main() {
  int N, Q;
  string s;
  cin >> N >> Q;
  cin >> s;
  map<char, int> min;
  map<char, int> max;
  map<char, int> now;
  for (int i = 0; i < N; ++i) {
    min[s[i]] == 0;
    max[s[i]] == 0;
    now[s[i]] == 0;
  }
  int n = min.size();
  char t;
  char d;
  for (int i = 0; i < Q; ++i) {
    cin >> t >> d;
    if (d == 'L') {
      --now[t];
    } else {
      ++now[t];
    }
    if (min[t] > now[t]) {
      min[t] = now[t];
    }
    if (max[t] < now[t]) {
      max[t] = now[t];
    }
  }
  int r = 0;
  for (int i = 'A'; i < 'Z' + 1; ++i) {
    if (min.count(i) == 1) {
      for (int j = -min[i]; j < N - max[i]; ++j) {
        if (s[j] == i) {
          ++r;
        }
      }
    }
  }
  cout << r << endl;
  return 0;
}
