#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  int pep[n];
  for (int i = 0; n > i; i++) {
    pep[i] = 1;
  }
  vector<int> alp[26];
  for (int i = 0; s.size() > i; i++) {
    alp[s[i] - 'A'].push_back(i);
  }
  for (int i = 0; q > i; i++) {
    char mv, arow;
    cin >> mv >> arow;
    for (int j = 0; alp[mv - 'A'].size() > j; j++) {
      if (arow == 'L') {
        if (alp[mv - 'A'][j] != 0) {
          pep[alp[mv - 'A'][j] - 1] += pep[alp[mv - 'A'][j]];
        }
        pep[alp[mv - 'A'][j]] = 0;
      } else {
        if (alp[mv - 'A'][j] != n - 1) {
          pep[alp[mv - 'A'][j] + 1] += pep[alp[mv - 'A'][j]];
        }
        pep[alp[mv - 'A'][j]] = 0;
      }
    }
  }
  int sm = 0;
  for (int i = 0; n > i; i++) {
    sm += pep[i];
  }
  cout << sm << endl;
}
