#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  vector<int> golems(N, 1);
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (int j = 0; j < N; j++) {
        if (s[j] == t) {
          if (j != 0) golems[j - 1] += golems[j];
          golems[j] = 0;
        }
      }
    }
    if (d == 'R') {
      for (int j = N - 1; j > -1; j--) {
        if (s[j] == t) {
          if (j != N - 1) golems[j + 1] += golems[j];
          golems[j] = 0;
        }
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++) sum += golems[i];
  cout << sum << "\n";
  return 0;
}
