#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 (d == 'L') {
      if (s[0] == t) {
        total -= x[0];
        x[0] = 0;
      } else {
        for (int j = 1; j < n; j++) {
          if (s[j] == t) {
            x[j - 1] += x[j];
            x[j] = 0;
          }
        }
      }
    }
    if (d == 'R') {
      if (s[n - 1] == t) {
        total -= s[n - 1];
        s[n - 1] = 0;
      } else {
        for (int k = n - 2; k >= 0; k--) {
          if (s[k] == t) {
            x[k + 1] += x[k];
            x[k] = 0;
          }
        }
      }
    }
  }
  cout << total << endl;
  return 0;
}
