#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7;
const double PI = (double)acos(-1);
const double EPS = (double)1e-10;
const long long dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const long long dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};
template <typename T>
void chmax(T &a, T b) {
  a = max(a, b);
}
template <typename T>
void chmin(T &a, T b) {
  a = min(a, b);
}
inline long long toInt(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();
}
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};
long long N, Q;
string s;
long long g[202020];
vector<long long> G[30];
char d[202020], t[202020];
signed main() {
  cin >> N >> Q >> s;
  for (long long i = 1; i <= N; i++) {
    g[i] = 1;
    G[s[i - 1] - 'A'].push_back(i);
  }
  for (long long i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  for (long long i = 0; i < Q; i++) {
    long long tmp;
    if (d[i] == 'L')
      tmp = -1;
    else
      tmp = 1;
    for (long long x : G[t[i] - 'A']) {
      g[x + tmp] += g[x];
      g[x] = 0;
    }
  }
  cout << N - g[0] - g[N + 1] << endl;
  return 0;
}
