#include <bits/stdc++.h>
using namespace std;
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q;
  string s;
  cin >> n >> q;
  char t[n], d[n];
  cin >> s;
  for (int i = 0; i < q; i++) {
    cin >> t[i] >> d[i];
  }
  int golem[n + 2];
  for (int i = 0; i < n + 2; i++) {
    if (i == 0)
      golem[i] = 0;
    else if (i == n + 1)
      golem[i] = 0;
    else
      golem[i] = 1;
  }
  for (int i = 0; i < q; i++) {
    int which;
    if (d[i] == 'R')
      which = 1;
    else
      which = -1;
    map<int, int> m;
    for (int j = 0; j < n; j++) {
      if (s[j] == t[i]) {
        m[j + 1] = golem[j + 1];
        golem[j + 1] = 0;
      }
    }
    for (auto& p : m) {
      golem[p.first + which] += p.second;
    }
  }
  int ans = n - golem[0] - golem[n + 1];
  cout << ans << endl;
  return 0;
}
