#include <bits/stdc++.h>
int main() {
  int N, Q, cnt = 0;
  int move[27] = {0};
  int max[27] = {0}, min[27] = {0};
  char S[200001];
  std::cin >> N >> Q >> S;
  for (int i = 0; i < Q; i++) {
    char t, d;
    std::cin >> t >> d;
    if (d == 'R')
      move[t - 'A']++;
    else
      move[t - 'A']--;
    if (move[t - 'A'] > max[t - 'A']) max[t - 'A'] = move[t - 'A'];
    if (move[t - 'A'] < min[t - 'A']) min[t - 'A'] = move[t - 'A'];
  }
  for (int i = 0; i < N; i++) {
    if (max[S[i] - 'A'] <= i && i <= N - 1 + min[S[i] - 'A']) cnt++;
  }
  std::cout << cnt << '\n';
}
