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