#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long N, Q, sum = 0;
  cin >> N >> Q;
  long long data[24] = {0};
  long long golem[24] = {1};
  char tmp, Ls, Rs;
  for (int i = 0; i < 24; i++) {
    golem[i] = 1;
  }
  cin >> tmp;
  Ls = tmp;
  data[tmp - 'A']++;
  for (long long i = 1; i < N - 1; i++) {
    char tmp;
    cin >> tmp;
    data[tmp - 'A']++;
  }
  cin >> tmp;
  Rs = tmp;
  data[tmp - 'A']++;
  for (long long i = 0; i < Q; i++) {
    char pos, d;
    cin >> pos >> d;
    if (d == 'R') {
      if (Rs == pos) {
        golem[pos - 'A']--;
      }
      golem[pos - 'A'] += data[pos - 'A'];
    } else {
      if (Ls == pos) {
        golem[pos - 'A']--;
      }
      golem[pos - 'A'] -= data[pos - 'A'];
    }
  }
  for (int i = 0; i < 24; i++) {
    if (data[i] > 0) {
      sum += golem[i];
    }
  }
  cout << sum << endl;
  return 0;
}
