#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, q;
  cin >> n >> q;
  string second;
  cin >> second;
  long long freq[26];
  memset((freq), 0, sizeof((freq)));
  vector<long long> v[26][2];
  for (long long i = 0, _n = (q); i < _n; i++) {
    char t, d;
    cin >> t >> d;
    long long ind = t - 'A';
    long long bit = 0;
    if (d == 'R') bit++;
    v[ind][bit].push_back(i);
  }
  long long ans1 = 0;
  long long x = 1000000000000000000;
  for (long long i = 0, _n = (26); i < _n; i++) {
    sort(v[i][0].begin(), v[i][0].end());
    sort(v[i][1].begin(), v[i][1].end());
  }
  for (long long i = 0, _n = (n); i < _n; i++) {
    long long ind = second[i] - 'A';
    if (v[ind][0].size() == 0) break;
    auto it = lower_bound(v[ind][0].begin(), v[ind][0].end(), x);
    if (it == v[ind][0].end())
      it--;
    else {
      if (it - v[ind][0].begin() == 0) break;
      it--;
    }
    ans1++;
    long long pos = it - v[ind][0].begin();
    x = v[ind][0][pos];
  }
  long long ans2 = 0;
  x = 1000000000000000000;
  for (long long i = n - 1; i >= 0; i--) {
    long long ind = second[i] - 'A';
    if (v[ind][1].size() == 0) break;
    auto it = lower_bound(v[ind][1].begin(), v[ind][1].end(), x);
    if (it == v[ind][1].end())
      it--;
    else {
      if (it - v[ind][1].begin() == 0) break;
      it--;
    }
    ans2++;
    long long pos = it - v[ind][1].begin();
    x = v[ind][1][pos];
  }
  cout << n - (ans1 + ans2) << endl;
}
