#include <bits/stdc++.h>
using namespace std;
long long int data[200100];
signed main() {
  long long int n, q;
  cin >> n >> q;
  set<long long int> s[26];
  for (long long int i = 0; i < 200100; i++) data[i] = 1;
  string str;
  cin >> str;
  for (long long int i = 0; i < n; i++) {
    s[str.at(i) - 'A'].insert(i);
  }
  long long int ans = 0;
  for (long long int i = 0; i < q; i++) {
    char t, d;
    cin >> t >> d;
    long long int index = t - 'A';
    if (d == 'L') {
      for (auto itr = s[index].begin(); itr != s[index].end(); itr++) {
        if (*itr == 0)
          ans += data[*itr];
        else
          data[(*itr) - 1] += data[*itr];
        data[*itr] = 0;
      }
    } else {
      for (auto itr = s[index].rbegin(); itr != s[index].rend(); itr++) {
        if (*itr == n - 1)
          ans += data[*itr];
        else
          data[(*itr) + 1] += data[*itr];
        data[*itr] = 0;
      }
    }
  }
  cout << n - ans << endl;
  return 0;
}
