#include <bits/stdc++.h>
using namespace std;
const long long MOD = long long(1e9 + 7);
const int IINF = INT_MAX;
const long long LLINF = LLONG_MAX;
const int MAX_N = int(1e4 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
vector<int> cnt;
int main() {
  int n, q;
  vector<int> moji[26];
  string s;
  cin >> n >> q >> s;
  for (int i = 0; i < n; i++) {
    moji[s[i] - 'A'].push_back(i + 1);
  }
  cnt.assign(n + 2, 1);
  cnt[0] = 0;
  cnt[n + 1] = 0;
  for (int i = 0; i < q; i++) {
    string t, d;
    cin >> t >> d;
    int m = t[0] - 'A';
    if (d == "L") {
      for (auto j : moji[m]) {
        cnt[j - 1] += cnt[j];
        cnt[j] = 0;
      }
    } else {
      for (auto j : moji[m]) {
        cnt[j + 1] += cnt[j];
        cnt[j] = 0;
      }
    }
  }
  cout << n - cnt[0] - cnt[n + 1] << endl;
  return 0;
}
