#include <bits/stdc++.h>
using namespace std;
void print(const vector<int> &v) {
  for (const auto &x : v) {
    cout << x << " ";
  }
  cout << endl;
  return;
}
void makeMat(vector<int> &mat, const vector<int> &target, int N) {
  for (auto &x : mat) {
    x = x + target[x];
    if (x > N) {
      x = 0;
    }
  }
  return;
}
int main() {
  int N, Q;
  string s;
  char t, d;
  vector<vector<int>> m(26);
  cin >> N >> Q;
  cin >> s;
  vector<int> mat(N + 2, 0);
  for (int i = 1; i <= N; ++i) {
    mat[i] = i;
  }
  int ll = s.size();
  for (int i = 0; i < ll; ++i) {
    char c = s[i];
    m[static_cast<int>(c - 'A')].emplace_back(i + 1);
  }
  vector<vector<vector<int>>> targets(
      26, vector<vector<int>>(2, vector<int>(N + 2, 0)));
  for (int i = 0; i < 26; ++i) {
    for (const auto &x : m[i]) {
      targets[i][0][x] = -1;
      targets[i][1][x] = 1;
    }
  }
  for (int i = 1; i <= Q; ++i) {
    cin >> t >> d;
    int k = static_cast<int>(t - 'A');
    int z = (d == 'L' ? 0 : 1);
    makeMat(mat, targets[k][z], N);
  }
  int ans = 0;
  for (int i = 1; i <= N; ++i) {
    if (mat[i] != 0) {
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}
