#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m, ll n) {
  if (n == 0) return abs(m);
  return (gcd(n, m % n));
}
void putYN(bool b) {
  if (b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
int main() {
  ll N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<char> t(Q), d(Q);
  vector<ll> s_num(N, 1);
  vector<vector<ll>> sindexs(50, vector<ll>());
  for (int i = 0; i < s.size(); ++i) {
    sindexs[s[i] - 'A'].push_back(i);
  }
  for (int i = 0; i < Q; ++i) {
    cin >> t[i] >> d[i];
  }
  for (int i = 0; i < Q; ++i) {
    char m = t[i];
    vector<ll> basho = sindexs[m - 'A'];
    if (d[i] == 'L') {
      for (auto itr = basho.begin(); itr != basho.end(); ++itr) {
        ll b = *itr;
        if (b - 1 >= 0) {
          s_num[b - 1] += s_num[b];
        }
        s_num[b] = 0;
      }
    } else {
      for (auto itr = basho.rbegin(); itr != basho.rend(); ++itr) {
        ll b = *itr;
        if (b + 1 < N) {
          s_num[b + 1] += s_num[b];
        }
        s_num[b] = 0;
      }
    }
  }
  ll sum = 0;
  for (int i = 0; i < s_num.size(); ++i) {
    sum += s_num[i];
  }
  cout << sum << endl;
  return 0;
}
