#include <bits/stdc++.h>
using namespace std;
int n, q;
int l[30], r[30], s[30];
string st, c, d;
int main() {
  cin >> n >> q >> st;
  for (int i = 0; i < q; ++i) {
    cin >> c >> d;
    if (d[0] == 'L') {
      l[c[0] - 'a'] = min(l[c[0] - 'a'], --s[c[0] - 'a']);
    } else {
      r[c[0] - 'a'] = max(r[c[0] - 'a'], ++s[c[0] - 'a']);
    }
  }
  int ans = n;
  for (int i = 0; i < n; ++i) {
    if (l[st[i] - 'a'] + i < 0 || r[st[i] - 'a'] + i > n) {
      --ans;
    }
  }
  cout << ans << endl;
  return 0;
}
