#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
#pragma GCC target("avx")
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using namespace std;
int main() {
  ll n, q;
  string s;
  cin >> n >> q >> s;
  vector<char> t(q), d(q);
  for (unsigned long long i = 0, i_len = (q); i < i_len; i++)
    cin >> t[i] >> d[i];
  vector<vector<int>> p('Z' + 1);
  for (unsigned long long i = 0, i_len = (n); i < i_len; i++) {
    p[s[i]].push_back(i);
  }
  vector<int> g(n, 1);
  for (unsigned long long i = 0, i_len = (q); i < i_len; i++) {
    if (d[i] == 'L') {
      for (const int &j : p[t[i]]) {
        if (j) {
          g[j - 1] += g[j];
        }
        g[j] = 0;
      }
    } else {
      for (const int &j : p[t[i]]) {
        if (j != n - 1) {
          g[j + 1] += g[j];
        }
        g[j] = 0;
      }
    }
  }
  cout << accumulate((g).begin(), (g).end(), 0) << endl;
}
