#include <bits/stdc++.h>
using namespace std;
void printv(vector<int> &v) {
  for (auto item : v) cout << item << " ";
  cout << endl;
}
int main() {
  int N, Q;
  string s;
  cin >> N >> Q;
  cin >> s;
  vector<char> t(Q), d(Q);
  for (int i = 0; i < Q; i++) {
    cin >> t[i] >> d[i];
  }
  vector<int> golem(N, 1);
  vector<vector<int>> reverseTD(26);
  for (int i = 0; i < N; i++) {
    reverseTD[s[i] - 'A'].push_back(i);
  }
  for (int i = 0; i < Q; i++) {
    auto moves = reverseTD[t[i] - 'A'];
    if (d[i] == 'L') {
      for (auto pos : moves) {
        auto temp = golem[pos];
        if (pos - 1 >= 0) golem[pos - 1] += temp;
        golem[pos] = 0;
      }
    } else {
      for (int i = N - 1; i >= 0; i--) {
        auto pos = moves[i];
        auto temp = golem[pos];
        if (pos + 1 < N) golem[pos + 1] += temp;
        golem[pos] = 0;
      }
    }
  }
  int sum = 0;
  for (auto g : golem) sum = +g;
  cout << sum << endl;
}
