#include <bits/stdc++.h>
using namespace std;
int main() {
  long N, Q;
  string S;
  cin >> N >> Q;
  cin >> S;
  long A[N];
  map<char, vector<int>> m;
  for (long i = 0; i < N; i++) {
    A[i] = 1;
    m[S[i]].push_back(i);
  }
  for (long i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    if (d == 'L') {
      for (auto j = m[t].begin(); j != m[t].end(); j++) {
        long z = *j - 1;
        if (0 <= z) {
          A[z] += A[*j];
        }
        A[*j] = 0;
      }
    } else {
      for (auto j = m[t].rbegin(); j != m[t].rend(); j++) {
        long z = *j + 1;
        if (z < N) {
          A[z] += A[*j];
        }
        A[*j] = 0;
      }
    }
  }
  long ans = accumulate(A, A + N, 0);
  cout << ans << endl;
  return 0;
}
