#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int>> mp(26);
  for (int i = 0; i < n; i++) {
    mp[s[i] - 'A'].push_back(i + 1);
  }
  char t, d;
  vector<int> sum(n + 2, 1);
  sum[0] = 0, sum[n + 1] = 0;
  for (int i = 0; i < q; i++) {
    cin >> t >> d;
    if (d == 'L') {
      for (auto j : mp[t - 'A']) {
        sum[j - 1] += sum[j];
        sum[j] = 0;
      }
    } else {
      for (auto j : mp[t - 'A']) {
        sum[j + 1] += sum[j];
        sum[j] = 0;
      }
    }
  }
  cout << n - sum[0] - sum[n + 1] << endl;
}
