#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
int N, Q;
string s;
int ans;
bool ng[200010];
vector<int> update[30];
char C[200010];
char lr[200010];
int main() {
  cin >> N >> Q;
  cin >> s;
  for (int i = (0); i < (Q); i++) {
    cin >> C[i] >> lr[i];
  }
  for (int i = (Q - 1); i >= 0; i--) {
    vector<int> newv[30];
    for (auto v : update[C[i] - 'A']) {
      if (ng[v]) continue;
      if (lr[i] == 'L') {
        if (!ng[v - 1]) {
          newv[s[v] - 'A'].push_back(v + 1);
          continue;
        }
        ng[v] = true;
        if (!ng[v + 1]) {
          newv[s[v + 1] - 'A'].push_back(v + 1);
        }
      } else {
        if (!ng[v + 1]) {
          newv[s[v] - 'A'].push_back(v + 1);
          continue;
        }
        ng[v] = true;
        if (!ng[v - 1]) {
          newv[s[v - 1] - 'A'].push_back(v - 1);
        }
      }
    }
    for (int c = (0); c < (26); c++) {
      if (C[i] == c)
        update[c] = newv[c];
      else {
        for (auto cc : newv[c]) update[c].push_back(cc);
      }
    }
    if (lr[i] == 'L') {
      if (!ng[0] and s[0] == C[i]) {
        ng[0] = true;
        update[s[1] - 'A'].push_back(1);
      }
    } else {
      if (!ng[N - 1] and s[N - 1] == C[i]) {
        ng[N - 1] = true;
        update[s[N - 2] - 'A'].push_back(N - 2);
      }
    }
  }
  for (int i = (0); i < (N); i++) {
    if (!ng[i]) ans++;
  }
  cout << (ans) << endl;
  return 0;
}
