#include <bits/stdc++.h>
using namespace std;
void solve(void) {
  int n, q;
  string s;
  cin >> n >> q >> s;
  set<pair<int, int>> mv[26];
  for (int i = 0; i < q; i++) {
    char a, d;
    cin >> a >> d;
    mv[a - 'A'].insert(make_pair(i, (d == 'R' ? 1 : -1)));
  }
  int ans = n;
  for (int i = 0; i < n; i++) {
    int c = s[i] - 'A', pos = i, turn = 0;
    while (pos >= 0 || pos < n) {
      auto v = &mv[c];
      auto it = lower_bound(v->begin(), v->end(), make_pair(turn, -2));
      if (it == v->end()) break;
      pos += it->second;
      if (pos < 0 || pos >= n) {
        ans--;
        break;
      }
      c = s[pos] - 'A';
      turn = it->first + 1;
    }
  }
  cout << ans << endl;
}
int main(void) {
  solve();
  return 0;
}
