#include <bits/stdc++.h>
int ans_minus(std::vector<std::vector<int> > &A, std::vector<int> &B, int t2,
              int c, int n) {
  for (int j = 0; j < (int)A[t2].size(); j++) {
    int p = A[t2][j];
    if (p + c <= -1 or p + c >= n) {
      B[p] = 0;
    } else {
      B[p + c] += B[p];
      B[p] = 0;
    }
  }
}
int ans_plus(std::vector<std::vector<int> > &A, std::vector<int> &B, int t2,
             int c, int n) {
  for (int j = (int)A[t2].size() - 1; j >= 0; j--) {
    int p = A[t2][j];
    if (p + c <= -1 or p + c >= n) {
      B[p] = 0;
    } else {
      B[p + c] += B[p];
      B[p] = 0;
    }
  }
}
int main() {
  int n, q;
  std::string s;
  std::cin >> n >> q >> s;
  std::vector<std::vector<int> > A(27);
  for (int i = 0; i < n; i++) {
    int s2 = s[i] - 'A';
    A[s2].push_back(i);
  }
  std::vector<int> B(n, 1);
  for (int i = 0; i < q; i++) {
    char t, d;
    std::cin >> t >> d;
    int t2 = t - 'A';
    if (d == 'L')
      ans_minus(A, B, t2, -1, n);
    else
      ans_plus(A, B, t2, 1, n);
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    count += B[i];
  }
  std::cout << count << std::endl;
  return 0;
}
