#include <bits/stdc++.h>
using namespace std;
set<int> charToInd[26];
int sum[200005];
int main() {
  int n, q;
  char t, d;
  string str;
  cin >> n >> q;
  cin >> str;
  int cnt = n;
  for (int i = 0; i < n; i++) {
    int c = str[i] - 'A';
    charToInd[c].insert(i);
    sum[i] = 1;
  }
  for (int i = 0; i < q; i++) {
    cin >> t >> d;
    set<int> st = charToInd[int(t - 'A')];
    if (st.empty()) continue;
    set<int>::iterator it = st.begin();
    vector<int> tmp;
    for (; it != st.end(); it++) {
      int index = *it;
      if (index == 0 && d == 'L') {
        cnt -= sum[0];
        sum[0] = 0;
      } else if (index == n - 1 && d == 'R') {
        cnt -= sum[n - 1];
        sum[n - 1] = 0;
      } else if (d == 'L') {
        sum[index - 1] += sum[index];
        sum[index] = 0;
        if (str[index - 1] == t) {
          tmp.push_back(index - 1);
        } else {
          charToInd[str[index - 1] - 'A'].insert(index - 1);
        }
      } else {
        sum[index + 1] += sum[index];
        sum[index] = 0;
        if (str[index + 1] == t) {
          tmp.push_back(index + 1);
        } else {
          charToInd[str[index + 1] - 'A'].insert(index + 1);
        }
      }
    }
    charToInd[t - 'A'].clear();
    for (int j = 0; j < tmp.size(); j++) charToInd[t - 'A'].insert(tmp[j]);
  }
  cout << cnt << endl;
  return 0;
}
