#include <bits/stdc++.h>
using namespace std;
int n, q, ans;
string s;
char t, d;
int table[3214514];
int ha[31][2314514];
int pos[31];
int main() {
  cin >> n >> q >> s;
  for (int i = 0; i < n; i++) table[i] = 1;
  for (int i = 0; i < n; i++) {
    int tmp = s[i] - 'A';
    ha[tmp][pos[tmp]] = i;
    pos[tmp]++;
  }
  while (q--) {
    cin >> t >> d;
    int tmp = t - 'A';
    if (d == 'R') {
      for (int i = pos[tmp] - 1; i >= 0; i--) {
        int cnt = table[ha[tmp][i]];
        table[ha[tmp][i]] = 0;
        if (ha[tmp][i] == n - 1)
          ans += cnt;
        else
          table[ha[tmp][i] + 1] += cnt;
      }
    }
    if (d == 'L') {
      for (int i = 0; i < pos[tmp]; i++) {
        int cnt = table[ha[tmp][i]];
        table[ha[tmp][i]] = 0;
        if (ha[tmp][i] == 0)
          ans += cnt;
        else
          table[ha[tmp][i] - 1] += cnt;
      }
    }
  }
  cout << n - ans << endl;
  return 0;
}
