#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q, s[2 * 100000], count = 0, INF = -2 * 100000;
  char pos, dir, str;
  vector<int> alpha[26];
  cin >> N >> Q;
  for (int i = 0; i < N; i++) {
    cin >> str;
    s[i] = i;
    alpha[str - 65].push_back(i);
  }
  for (int i = 0; i < Q; i++) {
    cin >> pos >> dir;
    for (int j = 0; j < alpha[pos - 65].size(); j++) {
      if (dir == 'R')
        s[alpha[pos - 65][j]]++;
      else
        s[alpha[pos - 65][j]]--;
      if (s[alpha[pos - 65][j]] == 0 || s[alpha[pos - 65][j]] == N - 1) {
        s[alpha[pos - 65][j]] = INF;
        count++;
      }
    }
  }
  cout << N - count;
}
