#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<char> &t = *(new vector<char>(q, 1));
  vector<int> &d = *(new vector<int>(q, 1));
  for (int i = 0; i < q; ++i) {
    char c;
    cin >> c;
    t[i] = c;
    cin >> c;
    if (c == 'L') {
      d[i] = -1;
    } else {
      d[i] = 1;
    }
  }
  vector<int> &g = *(new vector<int>(n, 1));
  int alive = n;
  for (int i = 0; i < q; ++i) {
    if (d[i] == -1) {
      for (int j = 0; j < n; ++j) {
        if (t[i] == s[j]) {
          if (j > 0) {
            g[j - 1] += g[j];
          } else {
            alive -= g[j];
          }
          g[j] = 0;
        }
      }
    } else if (d[i] == 1) {
      for (int j = n - 1; j >= 0; --j) {
        if (t[i] == s[j]) {
          if (j < n - 1) {
            g[j + 1] += g[j];
          } else {
            alive -= g[j];
          }
          g[j] = 0;
        }
      }
    }
  }
  cout << alive << endl;
  return 0;
}
