#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  int N, Q, cnt;
  cin >> N >> Q;
  cnt = N;
  string S;
  cin >> S;
  vector<int> C(N, 1), D(N, 1);
  map<char, vector<int>> A;
  for (int i = 0; i < N; i++) {
    A[S[i]].push_back(i);
  }
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    for (auto j = 0; j < A[t].size(); j++) {
      if (d == 'L') {
        if (A[t][j] == 0) {
          cnt -= C[0];
          D[0] = 0;
        } else {
          if (C[A[t][j]] > 0) {
            D[A[t][j]] = 0;
            D[A[t][j] - 1] += C[A[t][j]];
          }
        }
      } else {
        if (A[t][j] == N - 1) {
          cnt -= C[N - 1];
          D[N - 1] = 0;
        } else {
          if (C[A[t][j]] > 0) {
            D[A[t][j]] = 0;
            D[A[t][j] + 1] += C[A[t][j]];
          }
        }
      }
    }
    C = D;
  }
  cout << cnt << endl;
  return 0;
}
