#include <bits/stdc++.h>
using namespace std;
constexpr long long int linf = numeric_limits<long long int>::max() - 5;
constexpr int inf = numeric_limits<int>::max() - 5;
constexpr long long int mod = 1000000007;
int main() {
  int n, q;
  string s;
  cin >> n >> q;
  cin.ignore();
  getline(cin, s);
  vector<string> v(q);
  for (int i = 0; (i) < (q); i++) {
    getline(cin, v[i]);
  }
  int l = 0, r = n - 1, result = n;
  for (int i = (q)-1; (i) >= (0); (i)--) {
    if (v[i][2] == 'L') {
      if (s[l] == v[i][0]) {
        result--;
        l++;
      }
    } else {
      if (s[r] == v[i][0]) {
        result--;
        r--;
      }
    }
  }
  cout << result << endl;
  return 0;
}
