#include <bits/stdc++.h>
using namespace std;
using LONG = long long int;
using ULONG = unsigned long long int;
using namespace std;
int N, Q;
string s;
vector<char> t;
vector<char> d;
int solve() {
  vector<int> moves[26];
  vector<int> count;
  count.resize(N);
  for (unsigned int i = 0; i < N; ++i) count[i] = 1;
  for (unsigned int i = 0; i < N; ++i) {
    moves[s[i] - 'A'].push_back(i);
  }
  for (unsigned int i = 0; i < Q; ++i) {
    auto target = t[i] - 'A';
    if (d[i] == 'L') {
      for (int j = 0; j < moves[target].size(); ++j) {
        int idx = moves[target][j];
        if (idx - 1 >= 0) {
          count[idx - 1] += count[idx];
        }
        count[idx] = 0;
      }
    } else {
      for (int j = moves[target].size() - 1; j >= 0; --j) {
        int idx = moves[target][j];
        if (idx + 1 < N) {
          count[idx + 1] += count[idx];
        }
        count[idx] = 0;
      }
    }
  }
  int sum = 0;
  for (unsigned int i = 0; i < N; ++i) sum += count[i];
  return sum;
}
int main() {
  cin >> N >> Q;
  cin >> s;
  t.resize(Q);
  d.resize(Q);
  for (unsigned int i = 0; i < Q; ++i) cin >> t[i] >> d[i];
  cout << solve() << endl;
}
