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