#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll INF = 1e16;
const ll MOD = 1e9 + 7;
int main() {
  ll n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> t(q), d(q);
  vector<vector<pair<ll, char>>> v(26);
  ll l_sum = 0, r_sum = 0;
  for (ll i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
    v[t[i] - 'A'].push_back({i, d[i]});
    if (d[i] == 'L')
      l_sum++;
    else
      r_sum++;
  }
  vector<pair<ll, ll>> rem(q);
  for (ll i = 0; i < q; i++) {
    rem[i] = {l_sum, r_sum};
    if (d[i] == 'L')
      l_sum--;
    else
      r_sum--;
  }
  ll ans = n;
  for (ll i = 0; i < n; i++) {
    ll now = i, p = 0;
    for (;;) {
      if (now < 0 || now >= n) {
        cerr << i << endl;
        ans--;
        break;
      }
      if (now - rem[p].first >= 0 && now + rem[p].second < n) {
        break;
      }
      ll c = s[now] - 'A';
      ll itr = lower_bound(v[c].begin(), v[c].end(), make_pair(p, 'L')) -
               v[c].begin();
      if (itr >= v[c].size()) break;
      if (v[c][itr].second == 'L')
        now--;
      else
        now++;
      p = v[c][itr].first + 1;
    }
  }
  cout << ans << endl;
}
