#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, q, ans = 0;
  string s;
  cin >> n >> q >> s;
  map<char, long long int> m;
  for (long long int i = 0; i < n; i++) m[s[i]] = i + 1;
  while (q--) {
    char c, d;
    cin >> c >> d;
    if (m.count(c) && m[c] >= 1 && m[c] <= n) {
      if (d == 'L')
        m[c]--;
      else
        m[c]++;
      if (m[c] == 0 || m[c] == n) ans++;
    }
  }
  cout << n - ans;
}
