#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  while (scanf("%d%d", &a, &b) != EOF) {
    int count = 0;
    vector<int> V[26];
    char arr[a];
    int counting[a];
    scanf("%s", arr);
    for (int i = 0; i < a; i++) {
      counting[i] = 1;
      int temp = arr[i] - 'A';
      V[temp].push_back(i);
    }
    for (int i = 0; i < b; i++) {
      int dire;
      char c, d;
      cin >> c >> d;
      if (d == 'L')
        dire = -1;
      else
        dire = 1;
      int temp = c - 'A';
      for (int j = 0; j < V[temp].size(); j++) {
        int hehe = V[temp][j];
        if (hehe + dire < 0 || hehe + dire > a - 1 && counting[hehe] != 0) {
          count += counting[hehe];
          counting[hehe] = 0;
        } else {
          counting[hehe + dire] += counting[hehe];
          counting[hehe] = 0;
        }
      }
    }
    printf("%d\n", a - count);
  }
  return 0;
}
