#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, int> m[26];
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  for (int i = (0); i < (S.size()); ++i) {
    S[i] -= 'A';
    m[S[i]][i]++;
  }
  char t[Q];
  char d[Q];
  for (int i = (0); i < (Q); ++i) {
    cin >> t[i] >> d[i];
    t[i] -= 'A';
  }
  int ans = 0;
  for (int i = (0); i < (Q); ++i) {
    map<int, int> mc;
    mc = m[t[i]];
    m[t[i]].clear();
    int a = (d[i] == 'L' ? -1 : 1);
    for (auto e : mc) {
      if ((a == 1 and e.first == N - 1) or (a == -1 and e.first == 0)) {
        ans += e.second;
        continue;
      }
      m[S[e.first + a]][e.first + a] += e.second;
    }
  }
  cout << N - ans << endl;
  return 0;
}
