#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
const double pi = acos(-1);
const int SIZE = 1 << 17;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1}, alp[30];
long long fac[200005], finv[200005], inv[200005];
vector<long long> dij;
struct edge {
  long long to, cost;
};
vector<vector<edge> > G;
bool falled[200005];
long long mon[200005], ans;
int main() {
  long long a, b;
  string h;
  cin >> a >> b >> h;
  for (int i = 0; i < b; ++i) {
    char n, m;
    cin >> n >> m;
    if (m == 'L') {
      --alp[n - 'A'];
    } else {
      ++alp[n - 'A'];
    }
    if (m == 'L' && n == h[0]) {
      falled[0] = 1;
      ++ans;
    } else if (m == 'R' && n == h[h.length() - 1]) {
      falled[a - 1] = 1;
      ++ans;
    }
  }
  for (int i = 0; i < h.length(); ++i) {
    mon[i] = alp[h[i] - 'A'];
    if (i) {
      mon[i] += mon[i - 1];
    }
  }
  for (int i = 0; i < a; ++i) {
    if (abs(mon[i]) >= a - i - 1 && !falled[i] && mon[i] != 0) {
      ++ans;
      falled[i] = 1;
    }
  }
  for (int i = a - 1; i >= 0; --i) {
    if (abs(mon[i]) >= i && !falled[i] && mon[i] != 0) {
      ++ans;
      falled[i] = 1;
    }
  }
  cout << a - ans << endl;
}
