#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  string s;
  vector<char> ti(q);
  vector<char> di(q);
  cin >> n >> q;
  cin >> s;
  int ans = n - 1;
  vector<char> g(n);
  for (int k = 0; k < q; k++) {
    cin >> ti.at(k) >> di.at(k);
  }
  for (int k = 0; k < n; k++) {
    g.at(k) = k;
  }
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < q; k++) {
      char t = ti.at(k);
      char d = di.at(k);
      if (s[g.at(i)] == t) {
        if (d == 'R') {
          g.at(i) = g.at(i) + 1;
        } else {
          g.at(i) = g.at(i) - 1;
        }
      }
      if (g.at(i) == -1 || g.at(i) == n + 1) {
        ans = ans - 1;
        break;
      }
    }
  }
  cout << ans << endl;
}
