#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<char> t(Q);
  vector<char> d(Q);
  vector<int> num_gorem(N + 2);
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  for (int i = 0; i < num_gorem.size(); i++) {
    num_gorem[i] = 1;
  }
  num_gorem[0] = 0;
  num_gorem[N + 1] = 0;
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < s.size(); j++) {
      if (t.at(i) == s[j]) {
        if (d.at(i) == 'L') {
          num_gorem[j]--;
          num_gorem[j - 1]++;
        } else if (d.at(i) == 'R') {
          num_gorem[j]--;
          num_gorem[j + 1]++;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i < N; i++) {
    ans = num_gorem.at(i);
  }
  cout << ans;
  return 0;
}
