#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int>> snum(30);
  for (int i = 0; i < n; i++) {
    int a = s[i] - 'A';
    snum[a].push_back(i + 1);
  }
  vector<int> num(200010, 1);
  for (int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    int b;
    b = t - 'A';
    if (d == 'L') {
      for (int j = 0; j < (int)snum[b].size(); j++) {
        int x = snum[b][j];
        num[x - 1] += num[x];
        num[x] = 0;
      }
    } else {
      for (int j = (int)snum[b].size() - 1; j >= 0; j--) {
        int y = snum[b][j];
        num[y + 1] += num[y];
        num[y] = 0;
      }
    }
  }
  cout << n - (num[0] + num[n + 1] - 2) << endl;
  return 0;
}
