#include <bits/stdc++.h>
using namespace std;
int inputValue() {
  int a;
  cin >> a;
  return a;
}
void inputArray(int *p, int a) {
  for (long long i = (0); i < (a); i++) {
    cin >> p[i];
  }
}
void inputVector(vector<int> *p, int a) {
  for (long long i = (0); i < (a); i++) {
    int input;
    cin >> input;
    p->push_back(input);
  }
}
template <typename T>
void output(T a, int precision) {
  if (precision > 0) {
    cout << setprecision(precision) << a << "\n";
  } else {
    cout << a << "\n";
  }
}
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  char t[q], d[q];
  for (long long i = (0); i < (q); i++) {
    cin >> t[i] >> d[i];
  }
  int del = 0;
  vector<int> num(n, 1);
  map<int, vector<int>> mapping;
  for (long long i = (0); i < (n); i++) {
    mapping[s[i]].push_back(i);
  }
  for (long long i = (0); i < (q); i++) {
    if (d[i] == 'L') {
      for (long long j = (0); j < (mapping[t[i]].size()); j++) {
        if (mapping[t[i]][j] != 0) {
          num[mapping[t[i]][j] - 1] += num[mapping[t[i]][j]];
          num[mapping[t[i]][j]] = 0;
        } else {
          del += num[0];
        }
      }
    } else {
      for (int j = mapping[t[i]].size() - 1; j >= 0; j--) {
        if (mapping[t[i]][j] != n - 1) {
          num[mapping[t[i]][j] + 1] += num[mapping[t[i]][j]];
          num[mapping[t[i]][j]] = 0;
        } else {
          del += num[n - 1];
        }
      }
    }
  }
  cout << n - del << endl;
  return 0;
}
