#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000000001;
struct edge {
  int to, cost;
};
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
struct Road {
  double cost;
  int a, b;
};
long long x[200002] = {};
int main() {
  long long n, q;
  string s;
  long long total = 0;
  cin >> n >> q;
  cin >> s;
  total = n;
  for (int i = 0; i < n; ++i) {
    x[i] = 1;
  }
  for (int i = 0; i < q; ++i) {
    char t, d;
    cin >> t >> d;
    if (s[0] == t && x[0] > 0 && d == 'L') {
      total -= x[0];
      x[0] = 0;
    }
    if (s[n - 1] == t && x[n - 1] > 0 && d == 'R') {
      total -= x[n - 1];
      x[n - 1] = 0;
    }
    if (d == 'L') {
      for (int i = 1; i < n; i++) {
        if (s[i] == t) {
          x[i - 1] += x[i];
          x[i] = 0;
        }
      }
    } else {
      for (int i = n - 2; i >= 0; i--) {
        if (s[i] == t) {
          x[i + 1] += x[i];
          x[i] = 0;
        }
      }
    }
  }
  cout << total << endl;
  return 0;
}
