#include <bits/stdc++.h>
using namespace std;
bool a[200005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, q, count;
  string s;
  char c, v;
  memset(a, 1, sizeof(a));
  cin >> n >> q >> s;
  count = n;
  while (q--) {
    cin >> c >> v;
    for (int i = 0; i < n; i++) {
      if (s[i] == c && v == 'L') {
        if (i == 0)
          count -= a[i];
        else {
          a[i - 1] += a[i];
          a[i] = 0;
        }
      }
      if (s[i] == c && v == 'R') {
        if (i == n - 1)
          count -= a[i];
        else {
          a[i + 1] += a[i];
          a[i] = 0;
        }
      }
    }
  }
  cout << count;
  return 0;
}
