#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  cin >> N >> Q;
  string s;
  cin >> s;
  int rb[N];
  for (int i = 0; i < N; i++) {
    rb[i] = 1;
  }
  int count = 0;
  for (int i = 0; i < Q; i++) {
    string t, d;
    cin >> t >> d;
    if (d[0] == 'L') {
      for (int j = 0; j < N - 1; j++) {
        if (s[j] == t[0]) {
          if (j == 0) {
            count += rb[0];
          } else {
            rb[j - 1] += rb[j];
          }
          rb[j] = 0;
        }
      }
    } else {
      for (int j = N - 1; j >= 0; j--) {
        if (s[j] == t[0]) {
          if (j == N - 1) {
            count += rb[N - 1];
          } else {
            rb[j + 1] += rb[j];
          }
          rb[j] = 0;
        }
      }
    }
  }
  cout << (N - count) << endl;
  return 0;
}
