#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  map<char, vector<int>> mp;
  for (long long i = (long long)0; i < (long long)n; i++) {
    mp[s[i]].push_back(i);
  }
  vector<int> state;
  state.resize(n);
  for (long long i = (long long)0; i < (long long)n; i++) {
    state[i] = 1;
  }
  int ans = n;
  for (long long i = (long long)0; i < (long long)q; i++) {
    string t, d;
    cin >> t >> d;
    int sft = (d.compare(0, 1, "R")) ? -1 : 1;
    int m = mp[t[0]].size();
    for (long long j = (long long)0; j < (long long)m; j++) {
      long long k = (sft == 1) ? mp[t[0]][m - j - 1] : mp[t[0]][j];
      if (k + sft == -1 || k + sft == n) {
        ans -= state[k];
        state[k] = 0;
      } else {
        state[k + sft] += state[k];
        state[k] = 0;
      }
    }
  }
  cout << ans << endl;
}
