#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, Q;
  cin >> n >> Q;
  string s;
  cin >> s;
  char t[200010], d[200010];
  map<char, int> mp;
  map<int, int> a;
  map<int, int> b;
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  for (int i = 0; i < Q; i++) {
    if (d[i] == 'L') {
      mp[t[i]]--;
    } else {
      mp[t[i]]++;
    }
    a[t[i] - 'A'] = min(a[t[i] - 'A'], mp[t[i]]);
    b[t[i] - 'A'] = max(b[t[i] - 'A'], mp[t[i]]);
  }
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    int x = i;
    if ((x + a[s[i] - 'A'] < 0) || (x + a[s[i] - 'A'] >= n)) {
      ans++;
    } else if ((x + b[s[i] - 'A'] < 0) || (x + b[s[i] - 'A'] >= n)) {
      ans++;
    }
  }
  cout << n - ans << endl;
}
