#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1010000000;
const double EPS = 1e-10;
const pair<long long, long long> fd[] = {make_pair(1, 0), make_pair(-1, 0),
                                         make_pair(0, 1), make_pair(0, -1)};
vector<long long> init(long long size) {
  vector<long long> par(size, -1);
  return par;
}
long long root(long long x, vector<long long>& par) {
  if (par[x] < 0) {
    return x;
  } else {
    return par[x] = root(par[x], par);
  }
}
bool same(long long x, long long y, vector<long long>& par) {
  return root(x, par) == root(y, par);
}
void unite(long long x, long long y, vector<long long>& par) {
  x = root(x, par), y = root(y, par);
  if (same(x, y, par)) return;
  par[x] += par[y];
  par[y] = x;
}
long long size(long long x, vector<long long>& par) {
  return -par[root(x, par)];
}
long long pow(long long x, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return pow(x * x % MOD, n / 2);
  else
    return x * pow(x, n - 1) % MOD;
}
signed main() {
  long long n, q;
  cin >> n >> q;
  string ss;
  cin >> ss;
  deque<long long> s(n);
  for (long long i = (0); i < (n); i++) {
    s[i] = ss[i] - 'A';
  }
  vector<pair<long long, bool>> p(n);
  for (long long i = (0); i < (q); i++) {
    char t, d;
    cin >> t >> d;
    long long tt = t - 'A';
    bool dd = (d == 'L');
    p[q - 1 - i] = make_pair(tt, dd);
  }
  for (long long i = (0); i < (q); i++) {
    pair<long long, bool> c = p[i];
    if (c.second && s[0] == c.first) {
      s.pop_front();
    } else if (!c.second && s[s.size() - 1] == c.first) {
      s.pop_back();
    }
  }
  cout << s.size() << endl;
}
