#include <bits/stdc++.h>
using namespace std;
int n, m, f[300], a[300], ans, tot;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    char c;
    cin >> c;
    f[c]++;
    a[c]++;
  }
  for (int i = 1; i <= m; i++) {
    char c, d;
    cin >> c >> d;
    if (d == 'L') {
      if (a[c - 1]) {
        f[c - 1] += f[c];
        f[c] = 0;
      } else
        f[c] = 0;
    } else if (d == 'R') {
      if (a[c + 1]) {
        f[c + 1] += f[c];
        f[c] = 0;
      } else
        f[c] = 0;
    }
  }
  for (char i = 'A'; i <= 'Z'; i++)
    if (a[i]) ans += f[i];
  cout << ans << endl;
  return 0;
}
