#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int main() {
  vector<int> map[26];
  int n, q, count;
  scanf("%d %d", &n, &q);
  int golem[n];
  for (int i = 0; i < (n); i++) golem[i] = 1;
  string s;
  cin >> s;
  for (int i = 0; i < (s.length()); i++) {
    count = static_cast<int>(s[i] - 'A');
    map[count].push_back(i);
  }
  vector<pair<int, int> > dou;
  char tmp, move;
  for (int i = 0; i < (q); i++) {
    scanf("%*c%c %c", &tmp, &move);
    count = static_cast<int>(tmp - 'A');
    if (move == 'R')
      dou.push_back(make_pair(count, 1));
    else
      dou.push_back(make_pair(count, -1));
  }
  for (int i = 0; i < (q); i++) {
    int co = dou[i].first;
    int l = map[co].size();
    if (dou[i].second == 1) {
      for (int j = l - 1; j >= 0; j--) {
        int m = map[co][j];
        golem[m + 1] += golem[m];
        golem[m] = 0;
      }
    } else {
      for (int j = 0; j < (l); j++) {
        int m = map[co][j];
        golem[m - 1] += golem[m];
        golem[m] = 0;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < (n); i++) {
    ans += golem[i];
  }
  printf("%d\n", ans);
  return 0;
}
