#include <bits/stdc++.h>
using namespace std;
struct Spell {
  char t;
  char d;
};
istream &operator>>(istream &is, Spell &obj) {
  is >> obj.t >> obj.d;
  return is;
}
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  Spell *spells = new Spell[q];
  cin >> s;
  for (int i = 0; i < q; ++i) cin >> spells[i];
  list<int> tile[27];
  for (int i = 0; i < n; ++i) {
    int index = s[i] - 'A';
    tile[index].push_back(i);
  }
  vector<int> golems(n, 1);
  int fallen = 0;
  for (int i = 0; i < q; ++i) {
    Spell spell = spells[i];
    int index = spell.t - 'A';
    for (int x : tile[index]) {
      if ((x == 0 && spell.d == 'L') || (x == n - 1 && spell.d == 'R'))
        fallen += golems[x];
      else {
        if (spell.d == 'L')
          golems[x - 1] += golems[x];
        else
          golems[x + 1] += golems[x];
      }
      golems[x] = 0;
    }
  }
  cout << n - fallen << endl;
  return 0;
}
