#include <bits/stdc++.h>
using namespace std;
inline long long toLong(string s) {
  long long v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-5;
const double PI = acos(-1.0);
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<vector<long long> > g(26);
  for (long long i = (0); i < (g.size()); ++i) g[i].clear();
  for (long long i = (0); i < (N); ++i) {
    g[s[i] - 'A'].push_back(i);
  }
  long long ans = N;
  for (long long i = (0); i < (Q); ++i) {
    char t, d;
    cin >> t >> d;
    int index = t - 'A';
    int dir = d == 'L' ? -1 : 1;
    vector<long long> tmp_g = g[index];
    g[index].clear();
    for (long long j = (0); j < (tmp_g.size()); ++j) {
      int next = tmp_g[j] + dir;
      if (next < 0 || N <= next) {
        ans--;
        continue;
      }
      g[s[next] - 'A'].push_back(next);
    }
  }
  cout << (ans) << endl;
  ;
}
