#include <bits/stdc++.h>
using namespace std;
void print(long long int a[], long long int n) {
  for (long long int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}
long long int m(long long int x) { return x % 1000000007; }
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int p(long long int a, long long int b) {
  if (b == 0) return 1;
  long long int t = p(a, b / 2);
  if (b % 2 == 0)
    return t * t;
  else
    return a * t * t;
}
signed main() {
  long long int n;
  long long int q;
  cin >> n >> q;
  string s;
  cin >> s;
  long long int a[26] = {0};
  long long int mi[26];
  long long int mx[26];
  long long int co[26] = {0};
  for (long long int i = 0; i < 26; i++) {
    mi[i] = 1000000000000;
    mx[i] = -1000000000000;
  }
  while (q--) {
    char x, y;
    cin >> x >> y;
    if (y == 'R') {
      co[x - 65]++;
    } else {
      co[x - 65]--;
    }
    mi[x - 65] = min(mi[x - 65], co[x - 65]);
    mx[x - 65] = max(mx[x - 65], co[x - 65]);
  }
  long long int count = 0;
  for (long long int i = 0; i < n; i++) {
    if (i + mi[s[i] - 65] < 0 || i + mx[s[i] - 65] > n - 1) {
      count++;
    }
  }
  cout << n - count << endl;
  return 0;
}
