#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template <class T = int>
using V = vector<T>;
template <class T = int>
using VV = V<V<T> >;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  V<bitset<200000> > mask(26);
  for (int i = 0; i < n; ++i) {
    mask[s[i] - 'A'][i] = true;
  }
  auto imask = mask;
  for (auto&& e : imask) e.flip();
  V<char> t(q), d(q);
  for (int i = 0; i < q; ++i) cin >> t[i] >> d[i];
  bitset<200000> bs;
  for (int j = q - 1; j >= 0; --j) {
    if (d[j] == 'L') {
      auto nbs = bs << 1;
      nbs[0] = true;
      bs &= imask[t[j] - 'A'];
      bs |= nbs & mask[t[j] - 'A'];
    } else {
      auto nbs = bs >> 1;
      nbs[n - 1] = true;
      bs &= imask[t[j] - 'A'];
      bs |= nbs & mask[t[j] - 'A'];
    }
  }
  int res = n;
  for (int i = 0; i < n; ++i) {
    res -= bs[i];
  }
  cout << res << '\n';
}
