#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<vector<int>> dic(26, vector<int>());
  for (int i = 0; i < N; i++) dic[s[i] - 65].push_back(i);
  vector<int> golems(N, 1);
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 0; j < (int)dic[t - 65].size(); j++) {
        int k = dic[t - 65][j];
        if (k != 0) golems[k - 1] += golems[k];
        golems[k] = 0;
      }
    }
    if (d == 'R') {
      for (int j = dic[t - 65].size() - 1; j > -1; j--) {
        int k = dic[t - 65][j];
        if (k != N - 1) golems[k + 1] += golems[k];
        golems[k] = 0;
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++) sum += golems[i];
  cout << sum << "\n";
  return 0;
}
