#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e15;
const long long int MOD = 1e9 + 7;
template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()) {
  return vector2<T>(n0, vector<T>(n1, e));
}
template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()) {
  return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int n, q;
  string s;
  cin >> n >> q >> s;
  vector<long long int> cnt(n, 1);
  auto a = initVec2<long long int>(26, 0);
  for (long long int i = 0; i < (n); ++i) {
    a[s[i] - 'A'].push_back(i);
  }
  vector<pair<long long int, long long int>> query(q);
  for (long long int i = 0; i < (q); ++i) {
    char t, d;
    cin >> t >> d;
    query[i] = {t - 'A', d == 'L'};
  }
  long long int l = -1;
  for (long long int i = q - 1; i >= 0; i--) {
    if (l >= 0 && query[i].first == s[l] && query[i].second == 0) {
      l--;
      continue;
    }
    if (l < n - 1 && query[i].first != s[l + 1] - 'A') {
      continue;
    }
    if (query[i].second == 0) {
      continue;
    }
    if (l == n - 1) {
      continue;
    }
    l++;
  }
  long long int r = n;
  for (long long int i = q - 1; i >= 0; i--) {
    if (r < n && query[i].first == s[r] && query[i].second == 1) {
      r++;
      continue;
    }
    if (r > 0 && query[i].first != s[r - 1] - 'A') {
      continue;
    }
    if (query[i].second == 1) {
      continue;
    }
    if (r == 0) {
      continue;
    }
    r--;
  }
  cout << n - (l + 1 + n - r) << endl;
  return 0;
}
