#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline constexpr int intpow(ll a, ll b) {
  if (b == 0) return 1;
  ll ans = intpow(a, b / 2);
  return ans * ans * (b & 1 ? a : 1);
}
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
inline ll digitsum(ll x) {
  ll dig, sum = 0;
  while (x) {
    dig = x % 10;
    sum = sum + dig;
    x = x / 10;
  }
  return sum;
}
inline bool prime(ll x) {
  if (x < 2) return 0;
  if (x < 4) return 1;
  if (!((x % 2) && (x % 3))) return 0;
  for (ll i = 5; i * i < x; i += 4 - i % 6 / 2) {
    if (x % i == 0) return 0;
  }
  return 1;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll LINF = 0x1fffffffffffffff;
const int INF = 0x3fffffff;
const ll MOD = 1000000007;
signed main() {
  ll n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  string t, d;
  for (ll i = 0; i < q; i++) cin >> t[i] >> d[i];
  ll ans = 0;
  vector<ll> cnt(n);
  for (ll i = 0; i < n; i++) cnt[i] = i;
  vector<string> p(n);
  for (ll i = 0; i < n; i++) p[i] = s;
  vector<bool> f(n);
  for (ll i = 0; i < q; i++) {
    for (ll j = 0; j < n; j++) {
      if (!f[j]) {
        if (p[j][j + cnt[j]] == t[i]) {
          if (d[i] == 'R') {
            cnt[j]++;
            if (cnt[j] >= n) {
              f[j] = 1;
              continue;
            }
          } else {
            cnt[j]--;
            if (cnt[j] < 0) {
              f[j] = 1;
              continue;
            }
          }
        }
      }
    }
  }
  for (ll i = 0; i < n; i++) {
    if (!f[i]) ans++;
  }
  cout << ans;
}
