#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  int c = N;
  vector<pair<char, int> > data;
  char t[Q], d[Q];
  for (int i = 0; i < s.size(); i++) {
    data.push_back(make_pair(s.at(i), i));
  }
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < N; j++) {
      if (t[i] == data[j].first) {
        if (d[i] == 'L' && data[j].second != -30) data[j].second--;
        if (d[i] == 'R' && data[j].second != -30) data[j].second++;
      }
      if ((data[j].second) < 0 || (N - 1 < data[j].second)) {
        if (data[j].second != -30) {
          c--;
          data[j].second = -30;
        }
      }
    }
  }
  cout << c << endl;
}
