#include <bits/stdc++.h>
using namespace std;
int n, q;
string s;
vector<int> pos[26];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> q;
  cin >> s;
  for (int i = 0; i < n; ++i) pos[s[i] - 'A'].push_back(i);
  vector<int> data(n, 1);
  int cnt = 0;
  string t, d;
  for (int i = 0; i < q && cnt < n; ++i) {
    cin >> t >> d;
    int cur = t[0] - 'A';
    if (d[0] == 'L') {
      for (int j = 0; j < pos[cur].size(); ++j) {
        int p = pos[cur][j];
        if (p > 0)
          data[p - 1] += data[p];
        else
          cnt += data[p];
        data[p] = 0;
      }
    } else {
      for (int j = pos[cur].size() - 1; j >= 0; --j) {
        int p = pos[cur][j];
        if (p < n - 1)
          data[p + 1] += data[p];
        else
          cnt += data[p];
        data[p] = 0;
      }
    }
  }
  cout << n - cnt << endl;
  return 0;
}
