#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<char> t(Q);
  vector<char> d(Q);
  for (int i = 0; i < (int)(Q); i++) cin >> t[i] >> d[i];
  vector<unordered_map<int, int>> ii(256);
  for (int i = 0; i < (int)(N); i++) {
    ii[s[i]][i] = 1;
  }
  int res = N;
  for (int i = 0; i < (int)(Q); i++) {
    char c = t[i];
    int dir = (d[i] == 'L') ? -1 : 1;
    for (auto &kv : ii[c]) {
      int pos = kv.first;
      int count = kv.second;
      int new_pos = pos + dir;
      if (new_pos < 0 || new_pos > N - 1) {
        res -= count;
        kv.second = 0;
        continue;
      }
      char new_c = s[new_pos];
      ii[new_c][new_pos] += count;
      kv.second = 0;
    }
  }
  cout << res << endl;
  return 0;
}
