#include <bits/stdc++.h>
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 (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
using uif = uint_fast64_t;
using ll = long long int;
int qp(int a, ll b) {
  int ans = 1;
  do {
    if (b & 1) ans = 1ll * ans * a % 1000000007;
    a = 1ll * a * a % 1000000007;
  } while (b >>= 1);
  return ans;
}
int qp(int a, ll b, int mo) {
  int ans = 1;
  do {
    if (b & 1) ans = 1ll * ans * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return ans;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(void) {
  ll n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> t(q);
  vector<char> d(q);
  for (int i = 0; i < (int)(q); i++) {
    cin >> t[i];
    cin >> d[i];
  }
  vector<vector<ll> > num_pos(26, vector<ll>(0));
  vector<ll> field(n, 1);
  for (int i = 0; i < (int)(s.size()); i++) {
    num_pos[s[i] - 'A'].push_back(i);
  }
  ll ans = 0;
  for (int i = 0; i < (int)(q); i++) {
    if (d[i] == 'L') {
      for (ll j = 0; j < num_pos[t[i] - 'A'].size(); j++) {
        ll pos = num_pos[t[i] - 'A'][j];
        ll next_pos = pos - 1;
        if (next_pos < 0) {
          ans += field[pos];
          field[pos] = 0;
        } else {
          field[next_pos] += field[pos];
          field[pos] = 0;
        }
      }
    } else {
      for (ll j = num_pos[t[i] - 'A'].size() - 1; j >= 0; j--) {
        ll pos = num_pos[t[i] - 'A'][j];
        ll next_pos = pos + 1;
        if (next_pos > n - 1) {
          ans += field[pos];
          field[pos] = 0;
        } else {
          field[next_pos] += field[pos];
          field[pos] = 0;
        }
      }
    }
  }
  cout << n - ans << endl;
  return 0;
}
