#include <bits/stdc++.h>
using namespace std;
template <class T>
void GETV(T &v) {
  for (int((i)) = (0); ((i)) < ((v.size())); ((i))++) {
    cin >> (v[i]);
  }
}
template <class T>
void SHOWV(T &v) {
  for (int((i)) = (0); ((i)) < ((v.size())); ((i))++) {
    cout << (v[i]) << endl;
  }
}
struct Spell {
  char t;
  char d;
};
int main() {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  vector<vector<int>> index = vector<vector<int>>(26);
  for (int i = 0; i < n; i++) {
    index[s[i] - 'A'].push_back(i);
  }
  vector<Spell> v(q);
  for (int i = 0; i < q; i++) {
    cin >> v[i].t >> v[i].d;
  }
  int extinction = 0;
  vector<int> list(n, 1);
  for (int i = 0; i < q; i++) {
    for (int j = 0; j < index[v[i].t - 'A'].size(); j++) {
      if (v[i].d == 'R') {
        if (index[v[i].t - 'A'][j] == n - 1) {
          extinction += list[index[v[i].t - 'A'][j]];
        } else {
          list[index[v[i].t - 'A'][j] + 1] += list[index[v[i].t - 'A'][j]];
        }
        list[index[v[i].t - 'A'][j]] = 0;
      } else {
        if (index[v[i].t - 'A'][j] == 0) {
          extinction += list[index[v[i].t - 'A'][j]];
        } else {
          list[index[v[i].t - 'A'][j] - 1] += list[index[v[i].t - 'A'][j]];
        }
        list[index[v[i].t - 'A'][j]] = 0;
      }
    }
  }
  cout << n - extinction << endl;
  return 0;
}
