#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; ++i) {
    cin >> t[i] >> d[i];
  }
  vector<int> n(N, 1);
  map<char, vector<int> > char_to_location;
  for (int i = 0; i < N; ++i) {
    if (char_to_location.find(s[i]) == char_to_location.end()) {
      char_to_location.insert(make_pair(s[i], vector<int>(1, i)));
    } else {
      char_to_location[s[i]].push_back(i);
    }
  }
  for (int i = 0; i < Q; ++i) {
    if (char_to_location.find(t[i]) == char_to_location.end()) {
      continue;
    }
    int move = (d[i] == 'R') ? +1 : -1;
    for (auto it = char_to_location[t[i]].begin();
         it != char_to_location[t[i]].end(); ++it) {
      if ((*it + move) >= 0 && (*it + move) < N) {
        n[*it + move] += n[*it];
      }
      n[*it] = 0;
    }
  }
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    ans += n[i];
  }
  cout << ans << endl;
  return 0;
}
