#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q, a[200000];
  char s[200000], t[200000], d[200000];
  cin >> N >> Q >> s;
  int sum = Q;
  for (int i = 0; i < Q; i++) {
    cin >> t[i];
    cin >> d[i];
    a[i] = 1;
  }
  for (int j = 0; j < Q; j++) {
    for (int i = 0; i < Q; i++) {
      if (s[i] == t[j]) {
        if (d[i] == 'R') {
          if (i != Q - 1) {
            a[i + 1] += a[i];
          } else {
            sum -= a[i];
          }
          a[i] = 0;
        } else {
          if (i != 0) {
            a[i - 1] += a[i];
          } else {
            sum -= a[i];
          }
          a[i] = 0;
        }
      }
    }
  }
  cout << sum;
  return 0;
}
