#include <bits/stdc++.h>
using namespace std;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T *)array, (T *)(array + N), val);
}
long long N, Q;
string S;
vector<vector<long long>> vec(26, vector<long long>());
void solve() {
  for (long long i = 0; i < S.size(); i++) {
    vec[S[i] - 'A'].emplace_back(i);
  }
  vector<long long> ans(N, 1);
  long long del = 0;
  for (long long i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'R') {
      for (auto itr = vec[t - 'A'].end() - 1;; --itr) {
        if (*itr == N - 1) {
          del += ans[*itr];
          ans[*itr] = 0;
        } else {
          ans[*itr + 1] += ans[*itr];
          ans[*itr] = 0;
        }
        if (itr == vec[t - 'A'].begin()) break;
      }
    }
    if (d == 'L') {
      for (auto itr = vec[t - 'A'].begin(); itr != vec[t - 'A'].end(); ++itr) {
        if (*itr == 0) {
          del += ans[*itr];
          ans[*itr] = 0;
        } else {
          ans[*itr - 1] += ans[*itr];
          ans[*itr] = 0;
        }
      }
    }
  }
  cout << N - del;
  return;
}
int main() {
  cin >> N >> Q >> S;
  solve();
  cout << endl;
  return 0;
}
