#include <bits/stdc++.h>
using namespace std;
int N, Q;
char s[1000000];
int num[1000000];
vector<int> address[26];
int main(void) {
  cin >> N >> Q >> s;
  for (int i = 0; i < N; i++) {
    address[(int)s[i] - 65].push_back(i);
    num[i] = 1;
  }
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    for (auto a : address[(int)t - 65]) {
      if (d == 'L') {
        if (a == 0)
          num[a] = 0;
        else
          num[a - 1] += num[a], num[a] = 0;
      } else {
        if (a == N - 1)
          num[a] = 0;
        else
          num[a + 1] += num[a], num[a] = 0;
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < N; i++) sum += num[i];
  cout << sum << endl;
  return 0;
}
