#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  vector<int> masu(N + 1, 1);
  vector<vector<int> > al(27, vector<int>());
  for (int i = 0; i < (int)(N); i++) {
    al[s[i] - 'A'].push_back(i);
  }
  for (int _ = 0; _ < (int)(Q); _++) {
    char t, d;
    cin >> t >> d;
    for (int i = 0; i < (int)(al[t - 'A'].size()); i++) {
      int index = al[t - 'A'][i];
      if (d == 'R') {
        if (index < N - 1) masu[index + 1] += masu[index];
        masu[index] = 0;
      } else {
        if (0 < index) masu[index - 1] += masu[index];
        masu[index] = 0;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < (int)(N); i++) ans += masu[i];
  cout << ans << endl;
  return 0;
}
