#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, Q;
  string s;
  cin >> N >> Q >> s;
  int min[26];
  int max[26];
  int position[26];
  for (int i = 0; i < 26; i++) {
    min[i] = 0;
    max[i] = 0;
    position[i] = 0;
  }
  for (int i = 0; i < Q; i++) {
    char t, d;
    cin >> t >> d;
    int idx = t - 'A';
    if (d == 'L') {
      position[idx]--;
      if (min[idx] > position[idx]) {
        min[idx]--;
      }
    } else if (d == 'R') {
      position[idx]++;
      if (max[idx] < position[idx]) {
        max[idx]++;
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    int idx = s[i] - 'A';
    if (i + min[idx] >= 0 && i + max[idx] <= N) cnt++;
  }
  cout << cnt << endl;
}
void cheatsheet() {
  vector<int> vecloop;
  for (int i = 0; i < 10; i++) {
    vecloop.push_back(i);
  }
  int a = 1;
  int b = 5;
  swap(a, b);
  int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  sort(arr, arr + 9, greater<int>());
  vector<int> vec(arr, end(arr));
  sort(vec.begin(), vec.end());
  cout << lower_bound(vec.begin(), vec.end(), 2)[0];
  map<pair<long long, long long>, long long> m;
  m[pair<long long, long long>(10, 100)] = 100;
}
